knightcrawler25 / GLSL-PathTracer

A toy physically based GPU path tracer (C++/OpenGL/GLSL)
MIT License
1.87k stars 176 forks source link

scene file light format #63

Closed vtushevskiy closed 2 years ago

vtushevskiy commented 2 years ago

How do you define quad lights in .scene file? There is position, v1, v2 parameters. Is 'position' a coordinates of the center of light? What are 'v1' and 'v2' vectors? UPDATE I think position, v1, v2 are just coordinates of the first three vertices of area light, right?

knightcrawler25 commented 2 years ago

position, v1 and v2 are the 3 vertices that define a quad like so:

image

Internally, u and v are calculated as v1 - position and v2 - position and cross product of u and v determines the emission side or the normal of the light