I worked on a cloth shading model for UE4. Its based on the cloth shader from Uncharted 4. The material uses three tiling texture maps, the weave pattern, imperfections, and memory/cloth folds. I am also making use of CharlieD.
@Ged "Charlie" is the name they called this sheen brdf model and the D at the end refers to just the distribution term of it. ________________ This is an anisotropic shading model I worked on for UE4 based on the shader from far cry 4.
Worked on improving the eye shader since I am using an old version of UE4. Added iris normal, more pronounced caustics and fake scattering by using wrap diffuse lighting.
Did some more work on the hair shader. I cant seem to find a value for the offset h, so I am currently using a random offset, which is the cause of the noise in the specular lobes.
Some gifs of the parameters:
BetaM - Longitudinal roughness from 0-1
BetaN - Azimuthal roughness from 0-1
Shift: shifts R, TT ,TRT along hair direction -1 to 1
Dude, your shading skills are so inspirational! I wish I could understand material networks >.< How did you get started?
Thanks. I think you start by just looking through the existing shaders the engine provides and then play around, modify them, and then see how it affects the material. Then you can start looking through papers/presentations and implement them into the engine.
So its been exactly two months since my last post. I have been slowly going through two of the recommended DirectX books in my spare time. I still haven't completed them yet, but I think I've made some progress worth showing from my previous post. https://blogs.msdn.microsoft.com/chuckw/2014/04/07/book-recommendations/
I started working on atmospheric scattering. Currently its full of bugs, but its nice to see something resembling the sky. I have not been able to figure out how multiple scattering, direct/ambient lighting or shadows fits into the puzzle yet and its hard to tell if what I have so far is even correct.
Sun Disc from left to right: without anything, with limb darkening, and with limb darkening + transmittance.
Rendering stars from HYG database as sprites this allows you to fly through them which a static image doesnt allow. I need to figure out how to blend it with the atmosphere though so it doesn't show through the clouds... not really sure how yet since it is rendered with a separate shader. Still needs glare, and some nebulae.
Added tangent based controls in the material editor (shift, rotation and direction).
Changed the skylight calculations.
Added two flavours of shift. One shifts along the tangent direction. The other control is the analogue to normal map I added an option to either use a tangent map for it or automatically derive it from the normal map.
As a tip when placing hair cards in maya you can use the hair tube shader and set it to v-tangent to visualize the flow of the specular highlight. This reduces the back and forth between maya and ue4.
I started learning marvelous designer. I focused on understanding sewing and patterns and how they are constructed in real life. These are exported straight from md into ue4. I find that some of the creases that appear in real life around the butt and horizontal creases do not appear in the simulation... does anyone have any tips on how to get them to appear?
Moved the rotation and shift controls to the material instead of the shader.
Added blur to the hair. This helps remove some of the dithering, improves the transition to the head, is cheaper than using translucency, and overall, softens the hair, but some of the details get lost.
Sheer cloth material using opacity mask. Good for curtains, panthose, and sheer fabrics.
The code below should be added into SkyLighting.usf. I haven't tested this, so you need to do some modifications to get this compile and operate as intended. Thickness is the value from your thickness texture.
The code below should be added into SkyLighting.usf. I haven't tested this, so you need to do some modifications to get this compile and operate as intended. Thickness is the value from your thickness texture.
I think it should actually be forward scattering... most likely the light vector, L, on line 19 should be negated, g should be positive and set somewhere between 0.25 to 0.5. These values were obtained visually because the transmission effect doesn't really show up too well otherwise. I guess at the time I felt 0.25 looked okay. Below I show g ranging from 0.25 to 1.
I think that video was pretty early on, so I cant remember the details of it. I ended up using http://www.iryoku.com/translucency/ for inspiration. You can use the shadow depth information from ShadowProjectionPixelShader.usf to approximate the distance, which gets passed to the shading model.
I wanted to get some real world reference of the sky so I can do some comparisons later on. I ended up using the fisheye images from the NREL Solar Radiation Research Laboratory (SRRL). The image quality isn't great and there are missing images from the datasets, but I cant find any better sources. I used Paul Bourke's site for learning about the fisheye projection and its conversion to a perspective projection. Ended up using DirectX 11.
Ported Bruneton's atmospheric scattering to DX11 using compute shaders and setup the camera so it always matches up the reference sky for doing comparisons. It seems to really struggle with the blues regardless of the time of day producing this unnatural green looking sky. Need to find out what is causing this.
I was playing around with the different parameters of the atmosphere shader and while I was able to get somewhat close to my references it was still far off. Instead of endless tweaking, I added non physically based parameters to control the overall appearance. But, It still struggles pretty hard during the twilight/'blue hour' period. Morning:
Quick and dirty normal map test. Currently just using the auto unwrap from zbrush and slapping on some presets from substance painter to test out the low poly.
Worked on a real time approximation for area light shadows using standard shadow mapping by stochastically sampling the area light and using the generated sample point for depth comparison instead of the light's center point. https://www.youtube.com/watch?v=0OJby2rLDZA
I started working on a physical camera and currently focusing on the depth of field and bokeh. A comparison between real life. Light source is 5mm in diameter at a distance of 3m, focus distance is 1.5m and focal length is 200mm. The real life images were taken from the slides of "Basic Implementation of Bokeh" since I don't have a dslr camera to validate with.
For the past couple days I have been trying to understand the fourier transform. One of its applications is faster convolutions and also being able to approximate the diffraction of waves through an aperture typically seen as glare on an image.
The bottom shows the amplitudes after applying the fourier transform on apertures with a varying number of blades. We see that there are twice the number of spikes if the number of blades is odd.
In the image below the size of the aperture is changed and the blade count is kept the same. More diffraction occurs when the aperture is smaller, but the amplitude decreases because less light makes it through.
To simulate the glare effect we perform a convolution using the kernel and image. The bottom half shows the generated glare effect. The images are currently being generated on CPU with a naive discrete fourier transform algorithm so, it unfortunately takes minutes to compute and is monochromatic.
Replies
I am also making use of CharlieD.
Linen, Velvet, and Silk.
References
https://knarkowicz.wordpress.com/2018/01/04/cloth-shading/
http://advances.realtimerendering.com/s2016/
"Charlie" is the name they called this sheen brdf model and the D at the end refers to just the distribution term of it.
________________
This is an anisotropic shading model I worked on for UE4 based on the shader from far cry 4.
do you have a link to the paper of the anisotropic shader?
Ged : Yep. pages 8-21
https://www.gdcvault.com/play/1022235/Rendering-the-World-of-Far
https://blogs.msdn.microsoft.com/chuckw/2014/04/07/book-recommendations/
References
Introduction to 3D Game Programming with Direct3D 11.0 by Frank Luna
Real-Time 3D Rendering with DirectX and HLSL: A Practical Guide to Graphics Programming by Paul Varcholik
Sun Disc from left to right: without anything, with limb darkening, and with limb darkening + transmittance.
References
youtu.be/zs0oYjwjNEo?t=1h17m58s
https://www.ea.com/frostbite/news/physically-based-sky-atmosphere-and-cloud-rendering
http://cgg.mff.cuni.cz/~oskar/projects/Theses/BScThesis_OskarElek.pdf
http://publications.lib.chalmers.se/records/fulltext/203057/203057.pdf
https://www.gamedevs.org/uploads/deferred-rendering-of-planetary-terrains-with-accurate-atmospheres.pdf
https://www.alanzucconi.com/2017/10/10/atmospheric-scattering-1/
Previewing slices of a 3D texture.
Still needs glare, and some nebulae.
http://www.astronexus.com/node/34/
https://www.youtube.com/watch?v=Sm78XUjVNw0
- Added tangent based controls in the material editor (shift, rotation and direction).
- Changed the skylight calculations.
Added two flavours of shift. One shifts along the tangent direction. The other control is the analogue to normal map I added an option to either use a tangent map for it or automatically derive it from the normal map.As a tip when placing hair cards in maya you can use the hair tube shader and set it to v-tangent to visualize the flow of the specular highlight. This reduces the back and forth between maya and ue4.
I still need to get the glints working correctly.
Sheer cloth material using opacity mask. Good for curtains, panthose, and sheer fabrics.
https://docs.unrealengine.com/en-us/Resources/Showcases/DigitalHumans#skinshading
The code below should be added into SkyLighting.usf. I haven't tested this, so you need to do some modifications to get this compile and operate as intended. Thickness is the value from your thickness texture.
Below I show g ranging from 0.25 to 1.
what technique was in this example?
Thank you for the detail explanations!
You can use the shadow depth information from ShadowProjectionPixelShader.usf to approximate the distance, which gets passed to the shading model.
I used Paul Bourke's site for learning about the fisheye projection and its conversion to a perspective projection.
Ended up using DirectX 11.
https://midcdmz.nrel.gov/apps/sitehome.pl?site=SRRLASI#
http://paulbourke.net/dome/fisheye/
Reference
http://www-evasion.imag.fr/Membres/Eric.Bruneton/
Worked on the retopology of the high poly. Is the topology good enough? What could be improved?
But, It still struggles pretty hard during the twilight/'blue hour' period.
Morning:
Late afternoon:
http://in1weekend.blogspot.com/2016/01/ray-tracing-in-one-weekend.html
https://www.youtube.com/watch?v=G8XwW-eFlLM
http://in1weekend.blogspot.com/2016/01/ray-tracing-second-weekend.html.
Had a hard time implementing the bounding volume hierarchy, which is an acceleration data structure that speeds up the intersection testing, since there is no recursion in hlsl.
https://www.youtube.com/watch?v=YkxBEEJTFmI
https://www.youtube.com/watch?v=Wgbzv--ofeE
https://www.youtube.com/watch?v=0OJby2rLDZA
A comparison between real life. Light source is 5mm in diameter at a distance of 3m, focus distance is 1.5m and focal length is 200mm. The real life images were taken from the slides of "Basic Implementation of Bokeh" since I don't have a dslr camera to validate with.
Reference
https://research.tri-ace.com/s2015.html
In the image below the size of the aperture is changed and the blade count is kept the same. More diffraction occurs when the aperture is smaller, but the amplitude decreases because less light makes it through.
To simulate the glare effect we perform a convolution using the kernel and image. The bottom half shows the generated glare effect.
The images are currently being generated on CPU with a naive discrete fourier transform algorithm so, it unfortunately takes minutes to compute and is monochromatic.
https://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm
References
http://www.bealto.com/gpu-fft2.html
https://www.youtube.com/watch?v=SkJgopq-JQA
Reference
http://nishitalab.org/user/nis/cdrom/pg/glare_m.pdf