-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about shader material #1572
Comments
If I understand correctly you want to override every object's material with a global one, right? You can set |
That instruction is helpful, but... does that mean I can write a global shader for that custom_material, and access the uv's, normals, vertex,... of every object, on the shader code? Because ray-tracing involves constant update on the colors of each object on the scene, I'll need all their properties. Let me put it another way, basically, the algorithm I'm thinking is:
So, the problem is on step 4, how would I update the shaderMaterial that way, or how would I change that specific object on global shader? |
Perhaps #1531 will help you. |
It indeed helps, I'll continue on that one. Thanks. |
Good day,
I'm working on a raytracer to try to add photorealism to the scenes. At first, I tried using THREE.Ray to shoot the rays through each pixel and get the interceptions with the available methods, and it worked really well, but sadly it is very slow to shoot a ray through every pixel (it really takes like 4-5 min to shoot a ray through every pixel even on lower resolution like 400x400).
So I had another idea, that is, to use shaders to shoot the rays and calculate every color change on the scenario. But since ray-tracing is a global ilumination method, then I'd need to have a global shader for the whole scene.
So...my question is, is there a way to use a global shader for every object in the scene? From the examples I've been watching, all of them need to have a THREE.shaderMaterial associated with an object, so the shaders can be applied to that object alone, but in this case I'll need to do it globally.
Not sure if I explained it very well, but I'd love an opinion on this. Thanks in advance.
The text was updated successfully, but these errors were encountered: