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.36k stars 133 forks source link

is there any way to set envMap with different background? #434

Closed dongho-shin closed 1 year ago

dongho-shin commented 1 year ago

untitled 192_1 Hi is there any way to set envMap with different background? like this image from keyshot

More details

scene.background = new THREE.Color(0xff00ff)
scene.environment = await new RGBELoader().loadAsync('DownloadHDRI URL')

if it can't why? Is it because a PathTracing light can update pixels in a texture?

gkjohnson commented 1 year ago

Multiple of the examples set both the background map and the lighting environment map to different textures. If you look here in the docs you can see separate backgroundMap and envMapInfo fields to set separately. Is this what you're referring to?

dongho-shin commented 1 year ago

@gkjohnson Yepp Thanks!! but it looks like converting normal Image(jpeg, png) to like HDRI I want to set background via THREE.Color, THREE.Texture(not HDRI), THREE.DataTexture(HDRI I check it works)

gkjohnson commented 1 year ago

Do you mean HDRI or an equirectangular map? There's no requirement that a background texture be HDRI.

If you want a solid color you can create a small texture for that color - or you can use a transparent background for static backdrop. Otherwise you'll have to make modifications to the path tracing shader.

dongho-shin commented 1 year ago

@gkjohnson Oh Thanks I get it I mean I test a Texture from png below KakaoTalk_Image_2023-04-03-18-37-57

Result

https://user-images.githubusercontent.com/108255990/234436357-6d8e92be-4a4a-4a79-a86b-ff5cc1c49305.mov

so I think PathTrace Shader convert Texture to equirectangular Map

P.S : BTW I confused the word sorry I just focus visual effects, so I use HDRI and Equirectangular Map interchangeably Also I always appreciate your kind reply. Have a good day