Wetness
by Joshua Horns · in Torque 3D Professional · 08/04/2009 (7:49 am) · 125 replies
Rumor has it the wetness effect won't be in the release, so I'd like to think about making one of my own.
To that end I'd like to view the wetness demo that was displayed a few months back but it appears to have been pulled. Is there any way to put that up on the site?
** NM found it on Gerhard's blog.
To that end I'd like to view the wetness demo that was displayed a few months back but it appears to have been pulled. Is there any way to put that up on the site?
** NM found it on Gerhard's blog.
About the author
#22
I know at this point there will probably be people who want to post about it here... but I'm trying to use this thread to talk about how to create the effect.
08/07/2009 (2:24 am)
Well it's one of the things that sold me too... but I think the story is it was created by a third party to show off the technology. I know at this point there will probably be people who want to post about it here... but I'm trying to use this thread to talk about how to create the effect.
#23
3rd party or not though, if its not in, it will be a refund for sure for my part (too much is "suttenly" 3rd part).
/hijack off :P
08/07/2009 (2:37 am)
Sure thing Joshua, it wasnt ment as a hijact of the thread, but it just catched my eye and since it was already up there i thought i'd ask.3rd party or not though, if its not in, it will be a refund for sure for my part (too much is "suttenly" 3rd part).
/hijack off :P
#24
I think I might have to try the material route... I cannot get my test texture to scroll in the SAME direction (forget even picking down). Adjacent triangles with similar normals scroll in radically different directions.
08/07/2009 (3:19 am)
@patI think I might have to try the material route... I cannot get my test texture to scroll in the SAME direction (forget even picking down). Adjacent triangles with similar normals scroll in radically different directions.
#25
If whether or not you have 1 special effect is the basis for your decision on whether or not to use Torque; you have much bigger things to worry about because you'll never finish a game.
Sometimes the truthiness hurts, I know and I'm sorry.
08/07/2009 (10:20 am)
Let's be honest here, having a wetness effect in the retail release of T3D is not going to make your game any more fun or any easier to complete.If whether or not you have 1 special effect is the basis for your decision on whether or not to use Torque; you have much bigger things to worry about because you'll never finish a game.
Sometimes the truthiness hurts, I know and I'm sorry.
#26
08/07/2009 (10:26 am)
must...direct...flames...away (I'll make another thread)
#27
08/07/2009 (10:29 am)
My apologies Joshua, I think it's very noble that you're trying to re-create this effect. I'll shut up and leave your thread alone now :)
#28
08/07/2009 (10:29 am)
BTW .. even if I can extrapolate positions from depth values to get a mapping to calculate "down" from the g-buffer, the number of texture samples will probably make it so slow as to be unusable.
#29
OK I am going to use a Post Effect to construct a buffer that contains world positions per pixel (done this part so far).
I'm going to use a second post effect to create rays from the pixel to adjacent pixels, average them and use the resultant vector to scroll the texture.
I will let you know how this works.
08/07/2009 (6:34 pm)
@Pat,OK I am going to use a Post Effect to construct a buffer that contains world positions per pixel (done this part so far).
I'm going to use a second post effect to create rays from the pixel to adjacent pixels, average them and use the resultant vector to scroll the texture.
I will let you know how this works.
#30
I think I give up on posteffect for this purpose.
08/08/2009 (7:51 am)
I tried constructing a map of 3d positions the following way. I then tried to use these positions in a second pass to calculate down vectors but all I got were crazy results, so far off it's not even worth it to describe them. I think I give up on posteffect for this purpose.
#include "shadergen:/autogenConditioners.h"
#include "./postFx.hlsl"
uniform float elapsedTime;
uniform sampler2D prepassTex : register(S0);
uniform float3 eyePosWorld;
//cameraPos + (viewDirection * depth)
float4 main( PFXVertToPix IN ): COLOR
{
float3 eyeRay = normalize( IN.wsEyeRay );
float depth = prepassUncondition(prepassTex, IN.uv0).w;
float3 thePosition = eyePosWorld + (eyeRay * depth);
return float4(thePosition.xyz, 0);
}
#31
This has several problems, firstly, world-space values can be negative, and RGBA8 (default target format) is unsigned, meaning it will assign '0' for values below 0. Next, it will assign '1' for any value above 1, this means that your world-space position is only valid between xyz values of [0..1], with that implementation.
I haven't gotten back around to this, but storing off world-space position in a target is actually probably not what you want to do first. Using a format which can store a proper world-space position takes a lot of space, and doesn't save you much beyond a Multiply-Add instruction.
08/08/2009 (10:37 am)
Right so, what you were trying to do (probably) is to encode world space position (XYZ) into 3 unsigned 8-bit values (RGB), unless you changed the target format to something like R16G16B16A16F. This has several problems, firstly, world-space values can be negative, and RGBA8 (default target format) is unsigned, meaning it will assign '0' for values below 0. Next, it will assign '1' for any value above 1, this means that your world-space position is only valid between xyz values of [0..1], with that implementation.
I haven't gotten back around to this, but storing off world-space position in a target is actually probably not what you want to do first. Using a format which can store a proper world-space position takes a lot of space, and doesn't save you much beyond a Multiply-Add instruction.
#32
In order to create a vector for the texture scroll I needed to sample the position at the current fragment, plus the positions at up to 9 adjacent fragments. Because the eye ray (I think) points to the current fragment I am not sure how to calculate position of anything other than the current. This is why I chose to store the positions and do a texture look-up.
08/08/2009 (11:05 am)
This was my post effect used to calculate the coords.singleton PostEffect ( CalcWorldFX )
{
isEnabled = false;
renderTime = "PFXBeforeBin";
renderBin = "ObjTranslucentBin";
renderPriority = 1;
shader = PFX_CalcWorldShader;
stateBlock = PFX_myShaderStateBlock;
texture[0]="#prepass";
target = "#worldPos";
targetFormat = "GFXFormatR16G16B16A16F";
};In order to create a vector for the texture scroll I needed to sample the position at the current fragment, plus the positions at up to 9 adjacent fragments. Because the eye ray (I think) points to the current fragment I am not sure how to calculate position of anything other than the current. This is why I chose to store the positions and do a texture look-up.
#33
I have a few higher-priority items to take care of before getting back on this.
08/08/2009 (11:16 am)
Ah shoot, and here I was hoping for the easy fix. That is a good call, and yeah, the eye-ray (in the PostEffect case) is only technically valid for the current pixel, because it is an interpolated value. Each corner of the full-screen quad represents the far-plane, in world-space, and so the eye-ray gets interpolated between those values.I have a few higher-priority items to take care of before getting back on this.
#34
08/15/2009 (10:06 pm)
typical programmers, just make the art so down is down and scroll the texture downwards
#35
No but seriously that doesn't work for a post effect. I'd have to use a custom material for local space.
08/16/2009 (3:34 am)
GREAT SCOTT!!No but seriously that doesn't work for a post effect. I'd have to use a custom material for local space.
#36
Here is a link to a method used to determine a blood-pool flow shader. Should give you a usable downhill flow method for the wetness. The example creates a gravity map based on the normal map and transforms the vector into a tangent space map.
developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/Direct3D9/src/HLSL_BloodShad...
Sorry if I am still off the mark, but the thread needs a "Bump" since everybody seems to be anxious for the wetness effect as originally demo'd.
08/25/2009 (2:58 pm)
If I understand the problem you guys are dealing with here, it is determining the direction of flow (Mainly finding the slope from any pixel).Here is a link to a method used to determine a blood-pool flow shader. Should give you a usable downhill flow method for the wetness. The example creates a gravity map based on the normal map and transforms the vector into a tangent space map.
developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/Direct3D9/src/HLSL_BloodShad...
Sorry if I am still off the mark, but the thread needs a "Bump" since everybody seems to be anxious for the wetness effect as originally demo'd.
#38
See it here: developer.nvidia.com/object/sdk_home.html
I couldn't install the DX9 SDK on my 64 bit systems so couldn't see it in action. Would be really great to use the bloodshader as intended. I can imagine a headshot with the gore splattering on a wall and sliding down.
Sorry to be off the subject here!
08/26/2009 (2:59 pm)
@Tom - Yes I was unaware of the nvidia SDK's - You should install the DX10 and run the "Rain" shader demo - Wow I love the effect - lighting, fog, and rain - Takes a DX10 though :(See it here: developer.nvidia.com/object/sdk_home.html
I couldn't install the DX9 SDK on my 64 bit systems so couldn't see it in action. Would be really great to use the bloodshader as intended. I can imagine a headshot with the gore splattering on a wall and sliding down.
Sorry to be off the subject here!
#39
What I need to do now is find a way to access the world matrix. It's not in the shader constants (that I can tell)
08/26/2009 (10:54 pm)
I've started looking at the blood implementation. What I need to do now is find a way to access the world matrix. It's not in the shader constants (that I can tell)
#40
Your could maybe add reflections in your textures to give it a more "wet" look, but i dont think that wetness is coming back.
But some of my levels would have looked better...
08/27/2009 (12:27 am)
they did mention in all of the torqe 3d blogs, that all of the stuff shown may not be final.Your could maybe add reflections in your textures to give it a more "wet" look, but i dont think that wetness is coming back.
But some of my levels would have looked better...
Torque Owner deepscratch
DeepScratchStudios