Hey everyone! I’ve got another issue that needs fixing!
I’ve been trying to find a way to do a cheap and easy water effect for my game. I discovered that you could create a rather nice effect simply by placing two watery textures over one another and moving the top one in a particular direction.
My problem is that it’s really slow. My frame rate drops from 60(I have vsync on) to 30 when I do that. So I get an incredible lost of performance. My PC is built to be a gaming PC with a quad core processor and a ATI Radeon HD 5750.
I don’t know a lot about messing with textures in Panda3D so if anyone could help me out here that’d be great! I’d be willing to go with a different water effect too if anyone knows of any that is relatively easy to implement.
It’s true that running a task that changes the state every frame is very expensive when used in conjunction with the shader generator, because it means a new shader must be compiled and generated every frame. If you have a custom shader, or if you use the fixed-function pipeline (shader generator off) on your particular node, you should have no problems.
I didn’t mean to be rude. Maybe there is a misunderstanding?
David thought I was suggesting this to Chompy, but I was suggesting this to ynjh_jo, because he said he didnt have a performance issue. And that was the reason he didn’t. Where am I rude?
Oh, I understand now. Yes, Anon, I think your meaning was unclear, and it was misperceived as curtness and therefore rudeness. Glad that’s cleared up now.
Ah yes I was just about to mention that I was shining a light on the water. That really makes more sense since I already knew the lighting/shader effects were expensive.
Thanks again guys, I’ll give it a try when I get home for work!
And… I’m glad you guys cleared up your little misunderstanding.
Ah yeah indeed it was the shaders. Also what I thought was moving the textures over one another was actually the shaders making the water effect I liked! …I’m sort of not very good at being able to tell the difference apparently! :X
Though after tweaking with it some more I was able to get it to look pretty good doing the method I originally described.
What? You said you moved their UVs, right? You can do that without shaders and you will get the same effect (if you didnt enable lightning, of course).
Or were you using a custom shader file?
Correct I was only moving the UV. I originally was being kind of stupid and thought I was getting the effect I was because I was moving the UV of the top texture over a lower texture but didn’t realize it was actually the shaders I was seeing making the effect.
The screenshots show it after I did some tweaking. There isn’t a huge difference now, so my original idea did work.
There isn’t a huge difference. I think you kind of see that the shaders give it more of a wavy appearance when it’s moving but other then that I think it looks pretty good either way.
Nope I sure wasn’t. I’m not sure I’m interested in learning how to write my own shaders at the moments. I’m sure I could get some snazzy looking water effects doing that though.
What effect are we talking about here? You should have the same effect without the shader generator. Are you talking about the texture animation? I cant tell much from your images, looks like one just isnt so bright because you disabled lightning.
The shader generator changed the surface of the water somewhat, and that is all that has been disabled.
There is still a light shining on the water surface, that has not been disabled.
All I have disabled is this…
self.model.find("**/water-top").setShaderAuto()
Disabling that is all I needed to get my frame rates back up. But I do see a pretty big difference and I some what liked what I saw with that on.
I have a video here that shows the difference. Maybe the you guys won’t think much of the difference I don’t know. The first part shows it without the shaders and the second part shows it with the shaders.