Skip to content

Conversation

@tigrazone
Copy link
Contributor

I dont understand why you use hardcoded consts like 0.5f / 180.f * 3.14159f, 45.f / 180.f * 3.14159f and vec3(0.0072f, 1.0f, 0.0034f).
Maybe better to use it as consts?

@gameknife
Copy link
Owner

Appreciate that! This project is under a time sensitive develop status, some refactor job always delayed...
I'm happy to accept this works, I will merge this after work.

Copy link
Owner

@gameknife gameknife left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a small bug when refactor the visibility buffer fetch:

I offset the instance_index in order to leave the default zero value to sky, but the get_material_index function has a slightly different, check the 2 comments.

thanks

Vertex get_material_data(ivec2 pixel, uvec2 vBuffer, vec3 ray_origin, vec3 ray_direction)
{
// fetch primitive_index high 14bit as instance index and low 18bit as triangle index
uint instance_index = vBuffer.x - 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not -1 here, this leads the hybrid renderer bugs with instance offset
remove it here, and vbuffer.x - 1 outside

Copy link
Contributor Author

@tigrazone tigrazone Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assets/shaders/common/VertexFunc.glsl
line 6 must be
uint instance_index = vBuffer.x;
?

assets/shaders/ModernDeferredShading.comp
line 48-50 is


    uvec2 vBuffer = imageLoad(MiniGBuffer, ipos).rg;
    vec2 uv = vec2(ipos) / vec2(size) * 2.0 - 1.0;
    vec4 origin = Camera.ModelViewInverse * vec4(0, 0, 0, 1);

please read code of my last commit. I fixed some code

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you start with --renderer=4, select hybrid renderer, the indirect shadow missing

the two get_material_data function before this change had a different:
the one in HybridShading is uint instance_index = vBuffer.x;
the one in ModernShading is uint instance_index = vBuffer.x - 1;

the fix I mentioned above will fix it

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vBuffer.x = vBuffer.x - 1; after line 48

@tigrazone
Copy link
Contributor Author

I will check and fix. Please wait

@tigrazone
Copy link
Contributor Author

done. please check. I use only RayTracingRenderer

@gameknife gameknife merged commit a09c9e3 into gameknife:dev Jun 19, 2024
@gameknife
Copy link
Owner

PR accepted, 🤝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants