gkjohnson / three-gpu-pathtracer

Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.
https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html
MIT License
1.32k stars 132 forks source link

Other material orbs #56

Closed gkjohnson closed 1 month ago

gkjohnson commented 2 years ago

https://casual-effects.com/data/

AntonPalmqvist commented 1 month ago

The "Standard Shader Ball" scene from ASWF is available here with a CC BY 4.0 license: https://github.com/usd-wg/assets/tree/main/full_assets/StandardShaderBall

gkjohnson commented 1 month ago

Thanks! I converted it to glTF with textures and materials here:

https://github.com/gkjohnson/3d-demo-data/tree/main/models/usd-shader-ball

It looks like Blender / glTF doesn't support exporting the area lights so we'll have to recreate those but it will be nice to have a consistent scene for comparisons.

I'll have to set up a new demo scene later.

gkjohnson commented 1 month ago

I see that the left side area light (15 x 15 m) is set to output 6327.84 W power and the four top lights are set to 11185.5 W power.

cc @donmccurdy do you know the Watt -> Candela conversion for area lights that should be used? I couldn't find one after searching online for a bit.

donmccurdy commented 1 month ago

Going from W to lm/sr/m^2, it'd be similar to what you see in Blender:

https://github.com/will-ca/glTF-Blender-IO/blob/af9e7f06508a95425b05e485fa83681b268bbdfc/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_lights.py#L92-L97

Note that even with the correct lighting unit conversion, you will not see the same results without changes to exposure. Unity glTFast physical lighting guide goes into some detail on this, but I'm not sure what the three.js equivalent of Blender's default exposure would be. Without that, matching lighting across tools is difficult.

gkjohnson commented 1 month ago

Thanks guys! I've updated the database scene to use the latest model and the following lighting conversions:

const area = light.width * light.height;
const lumens = PBR_WATTS_TO_LUMENS * watts;
light.intensity = lumens / ( area * 4 * Math.PI );

Link to the demo page is here. I'm not a Blender guru by any stretch so I had some issues with the model - specifically some textures seem to be lost in the conversion (specifically the Sub-Surface Bars) so I've hand adjusted the colors in those cases.

It also looks like orb surface was tessellated and smoothed for the Blender renders, which would be nice to have in the GLTF representation but I may have to revisit that once I know Blender a bit better. Or if someone can point me in the right direction I can take a look.

you will not see the same results without changes to exposure.

Thanks for the note. I've just hand tuned the exposure, for now, until there's a more reliable way to do this or I have more time to look into it.

AntonPalmqvist commented 1 month ago

Great to see the new shader ball in there! 🤩

To import with subdivision surfaces, check the Subdivision box under Geometry in the USD import dialog:

Screenshot 2024-07-20 at 10 33 30

To fix the missing SSS bar texture you need to re-assign the texture here:

Screenshot 2024-07-20 at 10 37 59

Before you export the .glb, make sure to Apply Transforms on the meshes, or just check this box in the glb export dialog:

Screenshot 2024-07-20 at 10 49 36

If you haven't already, I'd recommend you update to Blender 4.2 that just got released, as there's a bunch of USD updates in there!

Hope this helps!

gkjohnson commented 1 month ago

Thanks! So much nicer:

image image

One other question while it's on my mind - when loading the scene I'm multiplying the camera FoV 2x because otherwise it's pulled in really close. It's the same in Blender. Is this another import quirk? Here's the camera view from Blender and the same thing I get on rendering when loading it.

image
AntonPalmqvist commented 1 month ago

It seems that the camera was made for a square format render output, but since the USD import doesn't set any of the render settings you need to set the Output Resolution to a square format resolution in Scene settings:

Screenshot 2024-07-20 at 17 02 44