Mostrando entradas con la etiqueta hlsl. Mostrar todas las entradas
Mostrando entradas con la etiqueta hlsl. Mostrar todas las entradas
02 noviembre 2013
12 agosto 2013
Skin Shader for Unity (Iteration 2)
IBL support and seams fix attempt (still not perfect at all)

Another interesting idea is doing the blur iterations in a loop to avoid duplicating text and making it customizable:
RenderTexture.active = RTTBlur_H;
Graphics.Blit (RTT, RTTBlur_H, BlurMaterial_H, 0);
for(int i=0;i<iterations;i++)
{
RenderTexture.active = RTTBlur_V;
Graphics.Blit (RTTBlur_H, RTTBlur_V, BlurMaterial_V, 0);
RenderTexture.active = RTTBlur_H;
Graphics.Blit (RTTBlur_V, RTTBlur_H, BlurMaterial_H, 0);
}
RenderTexture.active = null;

The main improvements are not in visuals, but in the "system". Now is 100% automatic. The setup is simple, setup the shader and add the script, thats all. Before, I had to setup an extra camera manually, but adding some lines, it can be done without human interaction :)
Also, the object should be set in a new layer to avoid rendering anything else:
GameObject go = new GameObject ("Camera_RTT", typeof(Camera), typeof(Skybox));
Camera_RTT = go.camera;
Camera_RTT.enabled = false;
Camera_RTT.hdr = true;
Camera_RTT.cullingMask = (1 << SSSobject.layer);
Camera_RTT.backgroundColor = Color.black;
While updating:
Camera_RTT.transform.position = Camera.main.transform.position;
Camera_RTT.transform.rotation = Camera.main.transform.rotation;
Camera_RTT.fov = Camera.main.fov;
Another interesting idea is doing the blur iterations in a loop to avoid duplicating text and making it customizable:
RenderTexture.active = RTTBlur_H;
Graphics.Blit (RTT, RTTBlur_H, BlurMaterial_H, 0);
for(int i=0;i<iterations;i++)
{
RenderTexture.active = RTTBlur_V;
Graphics.Blit (RTTBlur_H, RTTBlur_V, BlurMaterial_V, 0);
RenderTexture.active = RTTBlur_H;
Graphics.Blit (RTTBlur_V, RTTBlur_H, BlurMaterial_H, 0);
}
RenderTexture.active = null;
22 julio 2013
Atmosphere (Iteration 4)
Once the basis was done, its time of improvement.
Not fixed result:
Video!
- Underwater ambient lighting. I noticed I completely forgot the ambient term, so I did some kind of bounce lighting to lit the objects downside
- Caustics animation and "diffraction"
- "Anisotropic" reflections
Later I use this information to turn down Scene distortion or reflections, turning into this:
Not fixed result:
- Added 2D clouds. To allow this little feature, I had to move the complex sky scattering to a skydome, because it was a postprocess, and this method enters in conflict with alpha blended shaders. So now, complex sky is in a dome in conjunction with the clouds texture. Now only exponential height fog remains as postprocess.
It also has a first approximation for lighting. Will be improved later.
15 julio 2013
Unity - Hard texture blend
Cool masked blend by vertex color with underwater shading support. It mixes uo to 5 textures with its normal maps. Blending hardness can be tweaked.
14 julio 2013
Unity - Underwater atmosphere (Iteration 3)
I extended the atmospheric system to allow both sky and underwater conditions.
The underwater rendering has been developed having in mind sort of "physical intuition", trying to capture the real world behaviour in an intuitive way. I included light inscattering and extinction, caustics blur according to deepness, surface color by deepness and proper fog computation.
Some beautiful shots:
19 junio 2013
Unity - Atmosphere Rendering (Iteration 2)
I extended the functionality of the previous fog by including the sky rendering I did for UDK months ago. This one includes night conditions and a better way to animate values according to time of the day.
15 mayo 2013
Fog for Unity (Iteration 1)
Basic exponential/height fog with directional light inscattering.
References:
The Henyey-Greenstein phase function
References:
The Henyey-Greenstein phase function
03 mayo 2013
Unity - Dynamic Exposure
I wanted to have eye adaption, but the current one in Unity works only with Reinhard tonemap, and I dont really like it. So I made it outside to allow using any other tonemaper.
25 abril 2013
Unity - Ferrari
Model donated by Luis Carrera.
This time I implemented "Frostbite2 / UE4" lens dirtness style.
Fixes:
This time I implemented "Frostbite2 / UE4" lens dirtness style.
Fixes:
- Alpha blend writes in Z buffer
- View dependent opacity
- Added reflections mask (AO map)
- Alpha test support
21 abril 2013
Unity - Car Rendering
All together, layered BRDF and TriAce BRDF with view dependent roughness.
Model by Cesar Martinez and presentation based in the great Visual Shaker Car Tune.
Model by Cesar Martinez and presentation based in the great Visual Shaker Car Tune.
17 abril 2013
Layered BRDF
Also with IBL support:
References:
Exploring the Potential of Layered BRDF Models.Andrea Weidlich, Alexander Wilkie
Layered Materials in Real-Time Rendering. Oskar Elek
07 abril 2013
06 abril 2013
Screen Space shadow filtering
At the end, I figured out how to improve the shadows. I thought in a screen space blur, like a postprocess.
First I render the mesh only with shadows, save to texture and blur to use it as shadow in the final shader.
The first problem is obvious, edges must to be fixed:


First I render the mesh only with shadows, save to texture and blur to use it as shadow in the final shader.
The first problem is obvious, edges must to be fixed:

Then I needed to find those edges. How? With the differente between the blurred depth and the original.

The perfect filter would be a bilateral filter (smart filter in photoshop) but instead getting mad doing it, I just tried to apply the idea by my self. Its not perfect, but works for now.

05 abril 2013
Fog Volume
What started as an attempt on calculating volume thickness, ended up with this :D Very good exercise, my head is smoky :P
03 abril 2013
Skin Shader for Unity (Iteration 1)
Ive been waiting some years until I could start with the implementation of the nVidia approach to real time skin rendering described in the GPU Gems3 Chapter14. But at last! I have to thank Christopher Schiefer and Carlos Macarron for their support and patience.
I couldnt bake the shadows in the unwraped mesh, and probably its almost impossible or extremely hard. This is a huge problem and loses lots of realism :/
The texture space diffusion is working well, although those greens bothers me. For the sub surface lighting I have used very basic and old school stuff and made the thickness map in real time.
Advanced Techniques for Realistic Real-Time Skin Rendering
Real-Time Approximations to Subsurface Scattering
I couldnt bake the shadows in the unwraped mesh, and probably its almost impossible or extremely hard. This is a huge problem and loses lots of realism :/
The texture space diffusion is working well, although those greens bothers me. For the sub surface lighting I have used very basic and old school stuff and made the thickness map in real time.
Advanced Techniques for Realistic Real-Time Skin Rendering
Real-Time Approximations to Subsurface Scattering
30 marzo 2013
TriAce BRDF for Unity (Iteration 2)
Improvements:
- Specular modulated with shadows
- IBL. Replaces NdotL with convoluted cubemap
- Blurred reflections. Blur depends on roughness
- Added tweakable parameters at runtime to the GUI
- View dependent roughness
- Parallax version
- Alpha test version
TriAce BRDF + IBL + Blurred Reflections
Still under development, but here is some progress:
I had a problem when creating the IBL cubemap.. I was used to import .exr textures with texture type set as Lightmap, but this didnt work when using a cubemap object. So sadly I had to do it in runtime. Imported as standard texture, in DXT1 and enconded to RGBM inside the shader as described by Brian Karis.
I had a problem when creating the IBL cubemap.. I was used to import .exr textures with texture type set as Lightmap, but this didnt work when using a cubemap object. So sadly I had to do it in runtime. Imported as standard texture, in DXT1 and enconded to RGBM inside the shader as described by Brian Karis.
o.Irradiance=DecodeLightmap(RGBMEncode(texCUBE(IBL,worldNormal).rgb));
For the reflections Im still using the Latitude/Longitude Map. Mainly to avoid texture lookups. For now Im using MIP levels depending on the roughness, but I have to do some more research. There is still a huge problem with edge seams.
24 marzo 2013
HDR IBL for Unity
Yeah! Some friends wanted to see some hdr reflections in the shader, so I have started learning about it with the help of Christopher Schiefer:
The file format is .exr and is treated as a lightmap, so I have done this:
final.rgb=DecodeLightmap(tex2Dlod(LongLat_Map, float4 ( coords, 0.0, MIP ))).rgb;
Internally this is just Source.a*8*Source.rgb
Coordinates are obtained this way:
Where RoV is just to change between V or R. I have to fix this :P
Resources:
http://www.hdri-hub.com/hdrishop/freesamples/freehdri/item/117-hdr-041-path-free
http://http.developer.nvidia.com/GPUGems/gpugems_ch17.html
The file format is .exr and is treated as a lightmap, so I have done this:
final.rgb=DecodeLightmap(tex2Dlod(LongLat_Map, float4 ( coords, 0.0, MIP ))).rgb;
Internally this is just Source.a*8*Source.rgb
Coordinates are obtained this way:
Where RoV is just to change between V or R. I have to fix this :P
Resources:
http://www.hdri-hub.com/hdrishop/freesamples/freehdri/item/117-hdr-041-path-free
http://http.developer.nvidia.com/GPUGems/gpugems_ch17.html
Specularity is everything
After making maps for roughness and normal reflectance, I am more conscious than ever of its importance. It gives us the needed information to make our brain interpret what kind of surface are we seeing. We can even imagine its touch. Indeed, I think a good specular map is even more important than albedo.
I rescued this model I made a while ago and those are the F0 and roughness maps:
I rescued this model I made a while ago and those are the F0 and roughness maps:
More detailed information about Fresnel Reflectance and Roughness can be found in:
Suscribirse a:
Entradas (Atom)


































.jpg)
.jpg)
.jpg)






