hoverinc / ray-tracing-renderer

[UNMAINTAINED] Real-time path tracing on the web with three.js
https://hoverinc.github.io/ray-tracing-renderer/
MIT License
646 stars 68 forks source link

Background rotation #65

Open VinAr22 opened 4 years ago

VinAr22 commented 4 years ago

Hello! Is it possible to replace the HDR scene with a black background, but keep hdr`s reflectivity on the object?

jaxry commented 4 years ago

Yes it is! We just recently added support for this. Just set your scene.background to a THREE.Color, and your background should use that color. I've updated the docs with this new information.

VinAr22 commented 4 years ago

Fantastic! Can i use texture as background in the same way?

jaxry commented 4 years ago

Sorry for the late response. I hadn't seen your reply until now :(

A 2D texture overlaid on the background doesn't work at the moment, but if you give scene.background a EnvironmentLight, the renderer will use that as the background (independent of lighting for the scene). Since Three.js officially supports textures as backgrounds, it's on my list to get it working for the ray tracing renderer too.

VinAr22 commented 4 years ago

All is ok, dont worry about that. Thanks for the information!

VinAr22 commented 4 years ago

@jaxry hi! Can you explain to me is it possible to rotate the environment around the 'y' axis?

jaxry commented 4 years ago

Hi @VinAr22 . Rotating an environment light directly is not supported right now, similar to how you can't rotate cubemaps in Three.js either. But you can effectively rotate the light by rotating the entire scene instead.

e.g. scene.rotateY(0.5)

Would that work for you?

VinAr22 commented 4 years ago

Thanks for the quick reply @jaxry! Im tried this solution. This does not correctly work if i pan my camera using orbit controls

jaxry commented 4 years ago

I think I ran into this issue too. Are you adding the camera to the scene object? If so, does removing the camera from the scene work?

VinAr22 commented 4 years ago

Yes, it does

VinAr22 commented 4 years ago

@jaxry I also tried to add object3d to the scene and attach an orbit pivot to it, but that didn't work either