patriciogonzalezvivo / lygia

LYGIA, it's a granular and multi-language (GLSL, HLSL, WGSL, MSL and CUDA) shader library designed for performance and flexibility
https://lygia.xyz
Other
2.53k stars 163 forks source link

Added shadow and support to Raymarched PBR #176

Closed shadielhajj closed 1 month ago

shadielhajj commented 1 month ago

When using PBR with raymarching, soft shadows and ambient occlusion can be turned on with

Default raymarching material Screenshot 2024-07-23 224507

Raymarched PBR Screenshot 2024-07-23 230017

Raymarched PBR with soft shadows Screenshot 2024-07-23 230027

Raymarched PBR with soft shadows and AO Screenshot 2024-07-23 230040

patriciogonzalezvivo commented 1 month ago

Nice! Question, have this been tested with geometry?

shadielhajj commented 1 month ago

@patriciogonzalezvivo This works only with raymarching. But since it needs to be enabled explicitly (when the aforementioned #defines), current behaviour with meshes is unaffected (I did test it).

patriciogonzalezvivo commented 1 month ago

Sweet. than you!

patriciogonzalezvivo commented 1 month ago

Getting this error when running https://github.com/patriciogonzalezvivo/lygia_examples/blob/main/lighting_pbrSsS.frag

image

Any ideas ?

patriciogonzalezvivo commented 1 month ago

mmm... seems is affecting code using pbr()

image

Happening in https://github.com/patriciogonzalezvivo/lygia_examples/blob/main/lighting_pbr.frag

patriciogonzalezvivo commented 1 month ago

Found the issue. Is the call for #include "../raymarch/softShadow.glsl" and #include "raymarch/ao.glsl". In point/directional lights and pbr function

shadielhajj commented 1 month ago

@patriciogonzalezvivo ooops. Let me see what's happening.

patriciogonzalezvivo commented 1 month ago

All good : ) I started the raymarching pipeline in a very messy way