Multi-Pass
Moderator: Moderators
Multi-Pass
The multi-pass shader "trick" I recently mentioned appears to only work in the Editor. Uniform shader variables aren't updated more then once in standalone builds. Now I don't know what the correct behavior is, but it would be nice if it was consistent between Preview and Build.
Attached - Some screenshots from the Editor.
K
- Attachments
-
- Fur.jpg (12 KiB) Viewed 10022 times
-
- Glow.jpg (35.24 KiB) Viewed 10025 times
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
I agree, this looks great.
I updated the beta today with a fix to the problem with updating uniform variables. If you set the new property "UpdateVarsOnEachUse" on the shader then the variables will be updated between models. You still need the trick of switching to another material though.
According to a discussion I found on a forum updating uniforms variables can sometimes be slow so it is not a recommended technique for updating hundreds of models every frame.
http://www.opengl.org/discussion_boards ... 667&page=1
I updated the beta today with a fix to the problem with updating uniform variables. If you set the new property "UpdateVarsOnEachUse" on the shader then the variables will be updated between models. You still need the trick of switching to another material though.
According to a discussion I found on a forum updating uniforms variables can sometimes be slow so it is not a recommended technique for updating hundreds of models every frame.
http://www.opengl.org/discussion_boards ... 667&page=1
Yup, I meant "between each use" regardless of it is the same model or not.
The default in ZGE is to update shader-variables once every frame but there was an ifdef in the code that updated on every use when in the designer. It should behave consistent now.
Please post an exe if you get it working Kjell, I'd love to see those graphics in motion.
The default in ZGE is to update shader-variables once every frame but there was an ifdef in the code that updated on every use when in the designer. It should behave consistent now.
Please post an exe if you get it working Kjell, I'd love to see those graphics in motion.
Voila,
A build of the fur shader. Doesn't have any dynamics ( wind, gravity etc. ) .. so it looks a little static and spiky. The artifacts when looking through hairs on the edge of the object towards others is caused by the lack of Z-Sorting ( on mesh level ).
Plus a build of the volumetric spot light shader in action.
K
A build of the fur shader. Doesn't have any dynamics ( wind, gravity etc. ) .. so it looks a little static and spiky. The artifacts when looking through hairs on the edge of the object towards others is caused by the lack of Z-Sorting ( on mesh level ).
Plus a build of the volumetric spot light shader in action.
K
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
vol
Yeah that works great,. and it looks very cool. So this 'fake' volumetric system, is it a series of progressively larger vesions of a light flare faceing the camera?
Somewhat like this (attached)? only sine I lack a 'face towards camera' function,. i am just adding a bunch of random jitter,. this experiment will make for a cool effect to be sure.., probably to be added to The Opium Wallpaper Wars.. , thanks Kj for the insperation!
Oh use the mouse to rotate!
Somewhat like this (attached)? only sine I lack a 'face towards camera' function,. i am just adding a bunch of random jitter,. this experiment will make for a cool effect to be sure.., probably to be added to The Opium Wallpaper Wars.. , thanks Kj for the insperation!
Oh use the mouse to rotate!
- Attachments
-
- jitter_beam_vol.zip
- .zgeproj
- (1.28 KiB) Downloaded 481 times
iterationGAMES.com
Hi jph,
Basically yes .. it's a similar technique as the fur shader actually.
And here's a cheap "spherical" billboard shader for sprites
K
Basically yes .. it's a similar technique as the fur shader actually.
And here's a cheap "spherical" billboard shader for sprites
Code: Select all
uniform float angle;
uniform float ratio;
void main()
{
vec2 center;
float rx = gl_Vertex.x * cos(angle) + gl_Vertex.y * sin(angle);
float ry = gl_Vertex.y * cos(angle) - gl_Vertex.x * sin(angle);
center.x = gl_ModelViewProjectionMatrix[3][0]/gl_ModelViewProjectionMatrix[3][3];
center.y = gl_ModelViewProjectionMatrix[3][1]/gl_ModelViewProjectionMatrix[3][3];
gl_Position.x = center.x + rx/gl_ModelViewProjectionMatrix[3][3];
gl_Position.y = center.y + ry/gl_ModelViewProjectionMatrix[3][3]*ratio;
}