Is it possible to set a fragment/vertex shader as envmap.
I’m curious if it can be used as IBL for a scene.
Is there any example available which does something like it?
Basically using a shader as envmap - which will be used as IBL to light an object.
Nope - envmap is a texture, shaders use textures, but are not textures on their own (you can technically render a shader into a texture. For IBL that’d also need to be a DataTexture, not the usual RGBA one.)
imo it wouldn’t be so complicated, you only have to map your shader to a box or sphere, inside-out w/ backside, cubecam-film it, send it straight into scene.background for reflections and scene.environment for lighting.
the following is a proof of concept. in react + three it merely means wrapping whatever you want inside the envmap inside drei/Environment. in vanilla you would follow the description above, that’s also what the environment component does.
thanks for the quick replies.
@drcmda never thought of that option - great point! I’m not used to react, but I’ve been able to setup a test scene; just need to figure out the cubmap-projection IBL ‘thingy’ you mentioned earlier.
@mjurczyk I’d be using the vector/fractal shader only as data mixer of images. Do you think it could be a viable solution to look into (based on the fact it’d be using only data images)?
Please have a look at the test… Any further input is very welcome.