Results 1 to 16 of 16
  1. #1

    Does mesh.transformUV change the UV's for all multi-user meshes?

    Hello!

    Does

    Code:
    import bge
    
    cont = bge.logic.getCurrentController()
    owner = cont.owner
    
    mesh = owner.meshes[0]
    
    from mathutils import Matrix as matrix
    mat = matrix.Scale(2,4,(1,0,0))
    
    mesh.transformUV(-1,mat,-1,-1)
    change the UV for every existing object that uses the mesh?

    If so, do i have to use LibNew to change it only for one object?

    Solved Edit:
    Yes mesh.transformUV changes UV's for all objects that use the same mesh.

    Solution:
    1. use LibNew (slow)
    2. use Nodes and change UV with color (better)
    Last edited by Leralasss; 20-Jul-17 at 12:10.
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  2. #2
    Member Nicholas_A's Avatar
    Join Date
    Oct 2014
    Location
    own.worldPosition
    Posts
    844
    I believe it does change for all users because you are still using the same mesh.
    My YouTube channel | My Blendswap profile | Current Project: Infinite Ammo

    I sell custom logos for $5 (among other things). Check them out!



  3. #3
    Yes. If you want a unique mesh you need to use libnew to create a new instance.



  4. #4
    Member BluePrintRandom's Avatar
    Join Date
    Jul 2008
    Location
    NoCal Usa
    Posts
    17,952
    what about using object color float as a input into a vector for a mapping node?

    like use the object color as a uv?
    Break it and remake it - Wrectified
    If you cut off a head, the hydra grows back two.
    "headless upbge"



  5. #5
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Where the best chocolate comes from
    Posts
    4,908
    what about using object color float as a input into a vector for a mapping node?
    This is a very very useful trick. I do it all the time.

    Using LibNew is a very slow way of solving this particular issue if you need to be adding new objects mid-game.
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  6. #6
    @Smoking_Mirror
    ok i thought that, thanks :P

    @BPR
    ok thats cool, i will see what i can do (i dont use nodes in my game, because i actually dont know how to use them)

    @sdgeoff
    i know that its slow, thats why i asked if i had to use LibNew :P

    But i would actually use it during a Loading Screen, which leads me to another question:

    the way i had it in my game was that i had many plates as wall/ground/ceiling (picture below)
    PlatesBefore.jpg

    yesterday i worked on merging the plates (deleting some and scaling others), thats why i want to scale the UV's (see picture)
    PlatesMerged.jpg


    my question:
    would it be more performance heavy for later if i used LibNew to make new Meshes for all the plates and scaled their UV? (later being: when the loading screen is gone and you walk around)

    Or

    would it be better to just leave it at many plates (not merged)?

    (not considering that now i know another way of doing it - with nodes)

    yes i know there are no textures on the plates yet, but in case i want to add textures later (which would make it look a lot better i think) i want to do this
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  7. #7
    @BPR
    can you please show me how to change the UV with nodes? xD

    edit:
    think i did it

    ChangeUVwithNodes.jpg

    edit2:
    ok is there a way to move the UV too?

    i just saw that i need to move the UV by 0.5 sometimes too..

    maybe use Blue and Alpha too, right now something only changes if i change Red or Green

    edit3:
    ok the second mapping node is unneccesary

    edit4:
    lol now it works.
    UV_WorkingItSeems.jpg

    edit5:
    here are the nodes for anyone wondering:
    ChangeUVwithNodesSolution.jpg
    Last edited by Leralasss; 17-Jul-17 at 05:59.
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  8. #8
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Where the best chocolate comes from
    Posts
    4,908
    Do the addition before the Mapping node. Then you can move it anywhere in UVSpace.
    And currently, to my disappointment, you can't use object alpha in the node editor.

    Hint: you can use splitRGB to access the individual channels of a vector. u=red v=green

    Also, with that few verts, it really doesn't matter if you merge them or not. You can successfully push nearly a million verts for the graphical side without too many issues. Physics, yeah, you'll need a lot less than that. Limited dissolve may be your friend here....
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  9. #9
    @sdgeoff
    oh thats nice to know with splitRGB, but somehow it now also works :P

    yes i noticed that physics are a problem, because in larger dungeons the framerate would be 2 without any enemies around (noticed that some weeks ago)

    so i disable physics for everything that is not in view of the player (everything that is 2 rooms away)


    What is Limited dissolve?
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  10. #10
    Ok so now i have another issue..

    The resulting Material is Shadeless..

    How do i get shade in my Nodes?
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  11. #11
    You need a separate material node.

    Is your material animated or is this just a work around to avoid having to go through and manually adjust all your UVs in blender?

    I recommend only using this method for animated textures as it has quite high overhead.
    I use it for switching colors of units in game, or animating water in rivers.



  12. #12
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Where the best chocolate comes from
    Posts
    4,908
    the framerate would be 2 without any enemies around (noticed that some weeks ago)
    Tips:
    - Make everything No Collision if possible
    - Character physics is expensive (apparently, I've never used it)
    - Use primitive bounds (eg [in order of cost] sphere, capsule, cylinder, cone, box, convex hull, triangle mesh)
    - Watch phymec's video

    You need a separate material node.
    And you probably want to feed in your texture as the "color"
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  13. #13
    @Smoking_mirror
    is the performance hit really big? i do this because i have plates that all use the same mesh
    no the texture is not animated

    @sdgeoff
    thanks for that video! I think i will change the chandeliers

    ok i got it with the Nodes :P
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  14. #14
    @sdgeoff
    do you know how he does the linking thing in the video at 22:23

    https://youtu.be/BGAwRKPlpCw?t=22m23s
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



  15. #15
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Where the best chocolate comes from
    Posts
    4,908
    Looks like may have a script that automagically links objects in the same group with rigid body joints in a sensible way. From memory he has developed some quite advanced tools both in BPY and BGE.
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  16. #16
    ah ok, i thought maybe it was something easy
    Check out my Dungeon Game: https://leralasss.itch.io/leralasss



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •