Horde3D

Next-Generation Graphics Engine
It is currently 23.11.2024, 00:13

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Texture "animation"
PostPosted: 12.10.2010, 17:04 
Offline

Joined: 04.09.2010, 21:42
Posts: 11
hey guys,

For the project I'm working we want to have some sort of water effect (flowing water) and in a previous project we used the UVs to "animate" a water effect (together displacing the normal map, it gave a pretty cool result). Anyway, as I noticed I don't have directly acces to the UVs in horde, but I can (from what I see) in shader, I reckon I would try to do it in that, but I got a few question first before I dive into that:

First of all, Am I on the right track with using a shader for that? I'm new to shaders, but as someone who is interested in special effect and graphics programming I really want to know more about it.

Second, reading through the pipeline doc, I think I would need to use the attribute vec2 texCoords0 and attribute vec2 texCoords1 for that. But how does this work? How can I write the new positions to this?

Any tips on this would be awesome :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Texture "animation"
PostPosted: 12.10.2010, 17:21 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
You rather want to set an additional uniform (e.g. uniform float animTime;) for that instead of working with the attribs (which you mostly cannot do anyways), rather compute the whole anim in the shader if poosible.


Top
 Profile  
Reply with quote  
 Post subject: Re: Texture "animation"
PostPosted: 12.10.2010, 17:49 
Offline

Joined: 11.09.2010, 20:21
Posts: 44
Location: Germany
Hello,

You do not write to the texCoord0/1 attribute, you get the current vertex' texture coords through these attributes, which are static and come from your water mesh. Then in the vertex shader you disturb these texture coords (and the normals, if needed) and give these new values to the fragment shader via some user-defined varying variables, which get interpolated across the triangles.
Or you just pass them through in the vertex shader and do the animation in the fragment shader, which should give more detail.
Anyway, I would suggest, you read some tutorial on shader (or specifically GLSL) programming first.
And yes, shaders are exactly the right way to do this kind of effects, as most effects are achieved through some specififc shader, especially in Horde3D.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group