adding water

okay wezu, i used your thingy, but i cant make it function as a non-standalone (importing the class into my existing game)

it says i need an instance of the class as the first argument to the method

I don’t think it will work that way. Take a look at the code, it’s not that complex ane I put some comments, so you should be able to merge it with your own code.

I could rewrite it, but I’m not sure when I’ll have the time to do it, or if it will be what you want.
It would need an interface to change the scale, speed, texture size, texture stages names, texture name, creating and destroing the buffer and all that other stuff to make it universal.

yeah, guess i could copy-paste it.
but i plan on doing the world generation and stuff in a separate file anyway when im building the actual game (this is just the tryouts) so you rewriting it would be extremely appreciated…

oh, and it gives an error anyway

even when i tried running the original file on its own.

something about arguments not matching the needed type in waterPlane.setTexScale(tex2,2,2)

i have no clue, could you take a look at that?

That’s strange. Are you using the files shipped with the demo?

“2” should be a valid argument, so maybe “tex2” is not?

if ‘waterPlane’ does not have a texture stage named ‘Tex2’ then it wont work.

i put everything where im sure panda can find it
all the original files, including the

Sorry, Can’t raally say what’s wrong. It works on my PC, and I can’t test it elsewhere.

I’ve rewritten the code so you should be able to use it with your own scene. Still the egg file is needed (I guess CardMaker could be used, but I’m lazy, and loading an egg always seamed easer for me - unfortunately that make the whole thing less portable) … 7670#87670

It it still gives you errors than one of us is doing something wrong.

no difference.

still some weird error. its huge, so im not overtyping, and i cant seem to get a screenshot posted, so i think i might use a different kind of water.

yours would have been awesome (probably, cause i dont know how it looks)

okay, looket at stuff, and noticed that the first argument seems to be missing: non-const NodePath this.

what version panda are you running?

I’m running 1.8.0 and now that I think of it I’m using a normal_gloss texture mode that was added in that version. If you’re using some older version then just replace ‘normal_gloss’ with ‘normal’ inside the egg files…or test it with a any other model.

im on 1.8.0 too

could you paste the error? because the example works quite well on my end. Im running panda 1.9.0 snapshot from sept 07

there you go.
too much text to type…

The problem appears to be that you’re passing in two scalars, when the method wants either a single scalar (a float, for example) or a vector holding either two or three scalars. Instead of passing in “texScale, texScale”, try passing in “Vec2(texScale, texScale)”, or, since you seem to have the same value for both U- and V- scale, just “texScale”, like so:

waterNode.setTexScale(waterNode, tex2, Vec2(texScale, texScale))
# or
waterNode.setTexScale(waterNode, tex2, texScale)

By the way, are you confident that you want to pass in “waterNode” as the first argument? That would seem to indicate that you’re scaling the texture relative to itself.

Note that the first NodePath mentioned in the patterns given in the error should be passed in automatically - you’re not expected to pass it in yourself. The NodePath that you’re passing in corresponds rather to the second NodePath parameter mentioned, for example, in pattern four (there named “other”), I believe.

im giving up.
nothing seems to work.
i could just have a friend of mine make a movie of moving water in blender and apply that as a texture to a card.

or something…

Just unzip (well… unrar) all the files that I put into water_v2.rar and run ‘’. Change nothing, just run it (type ‘ppython’).

Just run it to see if it runs and how it looks.

The interface I wrote for this is a bit… well it’s not the best, but it was written in a hurry.

First import the class:

from WaterAnimator import WaterAnimator

Then load a plane model, or generate one with CardMaker, or load any model, no-one says your water must be a flat plane… but be sure it has UVs and normal map texture stage (generate on if you must - that’s up to you).


Now set some parameters

#Tex2 is be the name of the normal map texture stage
#in water_plane2.egg

#Scale of the texture, how many times it will repeat 
#it's the same for x- and y- (or rather u- and v-)

#the uv scrolling is done with an interval
#this is the time (in seconds) it takes to finish 
#the interval
#the smaller the number the faster the movement 

#size of the offscreen buffer, it should be the same 
#size as the normal(-ish) textures used 

Make the whole thing work:

self.water=WaterAnimator(waterPlane, TextureStageName, textureScale, scrollTime, bufferSize)

I know it’s a bit misleading, that’s bad design on my part, but feel free to make it better :wink:

see, and thats where i keep guessing:
i DID run the unchanged version of your water_demo

thats very strange, its working great on my end - try reinstalling panda 1.8.0 or higher to see if that solves it because something is weird on your end lol.

well, i think im going to go with a simpler design:
a partially see-through blue plane of weirdness,
or a plane with a movie of a water animation playing on it. since in my game you cannot get level with the water, but the camera is always above it, that should work just fine.