ands / lightmapper

A C/C++ single-file library for drop-in lightmap baking. Just use your existing OpenGL renderer to bounce light!
1.41k stars 133 forks source link

Shadow baking #14

Closed lm165678 closed 3 years ago

lm165678 commented 3 years ago

Hello, I am studying your code, I tried to modify the shader to add bakeScene, but it seems that the shadow cannot be baked properly. Can you tell me an idea? Or provide some reference code? Sorry, I am a novice. Thank you!

ands commented 3 years ago

Hey @lm165678! You can find reference code in the example.c file. From your description it is not clear which part is not working. Can you provide more information please (e.g. screenshots)? What are you trying to achieve and what does your setup look like? Would you mind sharing your code maybe?

lm165678 commented 3 years ago

Sorry to reply you so late, I think I may know the reason. Radiosity does not seem to be used to bake shadows, but to simulate global illumination. Therefore, I used direct ray tracing to mark shadows and illuminate the part, and then used radiosity to bounce multiple times to simulate global illumination.

ands commented 3 years ago

You could use this library to bake shadows from area light sources (see example images on the front page). But since you seem to have a solution now, I'll close this ticket then :).