Self Shadowing Parallax Occlusion Shader
The only geometry in this scene are basic cube of 12 triangles each
I take the view vector and transform it into tangent space and step it along, sampling the heightmap texture along the way. I compare the Z height of the position with the texture sampled at the X,Y components. I keep adding this step vector to the position until it is below the height of the height map. When the position is lower than the heightmap, it breaks the loop and moves onto stage2, where it does basically the same thing, but it starts at the current position that it left off, but moves towards the light source. It uses the same sampling method and compares Z position with the texture, if it is below, means the ray has been blocked and this fragment is supposed to be in shadow.
https://pastebin.com/CQqqmypm Fragment Shader Code
Warning, It runs very slow. I'm on a 3080ti
Other Videos By Michael Lundgren (GoldenShadow)
2022-05-11 | Lit, rasterized 3D cube in MFD VR |
2022-05-11 | VR MFD Vertices and Edges |
2022-05-10 | 3D VR Effect MFD |
2022-05-03 | OpenGL fragment shader raytracer |
2022-04-29 | Around the world then parachute on top of VAB |
2022-04-29 | New Method to account for drag. Aim for the halfway impact position to target. |
2022-04-28 | Parachuting onto VAB from orbit |
2022-04-28 | Vizzy reentry and landing at launchpad |
2022-04-23 | Turret Controlled with Camera Tracking |
2022-04-21 | Screen Space RCS controls. |
2022-04-08 | Self Shadowing Parallax Occlusion Shader |
2022-03-31 | Auto leveling landing legs |
2022-03-25 | Walking Robot Finished |
2022-03-25 | Spiderbot 4 LegWalker |
2022-03-22 | MarioKart Vizzy MFD |
2022-03-21 | Opengl mouse controlled camera |
2022-03-16 | RayCaster Darkness Shading |
2022-03-15 | Raycaster Floor and Ceiling |
2022-03-12 | Textures added to RayCaster |
2022-03-06 | Homing Missile vs moving target |
2022-03-04 | ProNav Guided Missile |