need help with glsl shader

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Fury.
Posts: 25
Joined: Mon Dec 20, 2010 2:03 pm

need help with glsl shader

Post by Fury. »

i have some time ago wrote a directx shader, but now i'm having trouble in using it under opengl.

I need a glsl shader that accept as parameters 2 values(vertex shader)

f32 time
f32 vector3df

I need to move a vertex according to the time and vector3df

I simply want to move a point sprite cloud for doing rain effect. ( i will make a mesh with 1k-2k vertices)

All points will move down according to time and direction.

Any help? i don't understand why functions that have simple names in directx have such strange names in glsl.

How can I make the moving relative to a scene node and how can i make it relative to absolute coordinates?

i will not use a standard scene node because with vertex shader i can retranslate points every time they will go under the terrain (this need only a if in directx shader)..
and the translation can be done also in the plane. so this way there will be always rain around the player.

I cannot figure why this not work in GLSL
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Post by REDDemon »

The positioning of new vertices is always refererred to the absolute vertex coordinates (after applying all rotation and translation to the scene node) if you use ftrasnform(); glsl instruction.

You need to pass 2 uniform vec4. One contain the relative movement of rain particles. The other one the player coordinates in this way you can do all the check you needs. it musn't be difficult doing that.

EDIT:
I tried to do what you want but seems that this shader will work only for point coulds since if you use lines for retranslate vertices strange artifacs could occur (since a vertex shader can translate only 1 vertex but rain lines are made up of 2 vertices).

maybe for something more complex you'll need geometry shaders
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Post Reply