Hi everyone, I need to make a waterfall in my game. I’m thinking to do it with texture scrolling.
Converting a polygon (the format of the waterfall) in egg and then making a automatic texture animation for the water (panda3d.org/manual/index.php/A … _Animation), but how do I apply this automatic texture in my polygon?
Any idea? Or another suggestion to make an easy waterfall?
you would prefer to use move around texture-coordinates. it will simply “move” the texture. be sure to use a tile-able texture. at least tile-able in the direction you want the water to move. then do something like this:
for those who wanna have a look at it working. here is a complete snipset to see it in action. the only thing you need is a suited texture. i uploaded mine. feel free to use it, it’s nothing more than a streched noise made in gimp
Good job, ThomasEgi
To make it even more realistic, you could also try to add transparency, and several layers of these quads.
Also, what might be an interesting effect to try out is to add a glow effect to it with some noise as glow map. Then randomly shift the glow map’s texture coordinates to get a steamy effect
can you do oscillations with this same concept? meaning can i create a wave/ocean effect where the texture comes in and out but in a smooth and sort of ovalish way?
Water fall for me would be, a beam with a curve on the top. Vertex shader to move the uv and wobble the geometry a bit. Pixel shader that draw the water and the current view (extra disturbance camera) with slight misalignment of pixels ~ looks like you are looking through water. Then another pass that draws myst particles on the bottom into another camera that is acts like volumetric fog. 2 Different sounds attached to top and bottom. So that you can hear the difference.
depends on the kind of waterfall you’r trying to do.
water can fall in many different ways. for some i would prefer a particle only sollution, for others this simple effect with an additional transparnecy already is quite fine. for the kind of waterfalls you suggested i’d keep it a little bit more simple. moving the UV by code like its already done (there is no real difference for a single waterfall). i would skip wobbling effects,too and instead add a few particles falling allong aswell as the particle emmiter on the bottom.
i agree with sounds,too.
but if you compare effort/result. my code above is about the best you can get to reach a good compromise.
Nice, but how would you go about doing that to something thats inside something else? Like I have a town and its not broken into a river, house lights… but all in one (.egg). So like how can I find the cube (or river) to do this trick with?
its a matter of finding the correct node. if you check this one: https://www.panda3d.org/apiref.php?page=NodePath
in the text on the top is explained how to search a nodepath.
in easiest case you would “tag” your river in your modelling package. then you can search for this tag and then you already got it.
finding nodes was most likely discussed several times already on the forum. so try searching it for more detailed information
Ahaha idk, I tried both ways and didnt come up with much (besides soem erros). Maybe I am doing something wrong here.
//loaded map and everything called self.environ
self.river = self.environ.find("702") //702 is the name of cub thats my river
self.water = loader.loadTexture("Water01.png")
self.textureStage0 = TextureStage("stage0")
self.river.setTexture(self.textureStage0,self.water,1)
Ok I re-read some stuff on the site “/Tweaking_an_Existing_Model” to find out whats up and saw:
“bodyGeomNode=body.node()” so I changed it up and used
"self.river = self.river.node() " and got this error:
self.river = self.river.node()
AssertionError: !is_empty() at line 273 of c:\p3ds\panda\src\pgraph\nodePath.I
I know what the error means but I dont get why its giving it. The node is there it just isnt reading it I am guessing?
Yes, you’ve started your model in your modeling software as a cube, and so the “name” of it behind the scenes is still “cubeX” where X is the number of cubes you’ve made.
Panda isn’t going to do any abbreviation work for you; “cube702” is the full name of your GeomNode. You’re current attempt is trying to find a GeomNode named exactly “702”, which does not exist
Any luck after changing it? I’m rather interested to find of your success implementing this waterfall idea.
Haha yea your right, na I just didnt notiest the cube part for some reason x.x; =) I feel sorta dum now XD lol. Any case it works perty good=) I have to reset how the “water” runs then i’ll post some pics for everyone to see.