We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello. I created a cubemapshader with skybox textures as explained by TioPepe here:
https://forum.processing.org/two/discussion/7039/samplercube-and-ambient-reflection.
Now I would like to change the textures of the shader by using the images of a webcam. I've already tried to recreate the cubemapshader frame by frame with beginPGL() ..... endPGL(), but the time for the calculations is too long, so that's the wrong way. Does anybody know how a fast method to change the shadertextures?
Thanks :)
Answers
The Question is probaly already solved:
The following code works for me, i took it as personal challenge for learning processing,so it's a boilerplate code, works on PC, it has to be optimised, something to get started i'm too lazy at the moment to write any notes.
Here is a good tutorial https://processing.org/tutorials/pshader/
hi nabr,
thanks for your reply and your example. i've already had a short look at the shadertutorial but not enough time to dig deeper in the OPENGL-stuff
so far i've only modified the code mentioned in the thread above to update the cubemap in the draw() loop. currently i work with six cubemaptextures to create an environment which is then reflected by the loaded 3D geometry:
cubemap vertexshader:
cubemap fragmentshader:
is it possible to pass a frame of a 360 degree video to a shader? i'm looking for something like a spheremap shader instead of a cubemap shader...
@HBo I see some guys just "drag and drop" their textures on a sphere() and some do the hard math.
someone did already a lib for processing. i think you are more advanced user and can just put stuff together.
https://forum.processing.org/two/discussion/21471/p5video360-360videos-in-processing#latest
When I heard of it:
https://github.com/mrdoob/three.js/issues/1621
the latest comment, is work in progress shader: (the perspective should be fixed, when you are going for reflective obj) the bgShader works fine. just plug your video in.
https://forum.processing.org/two/discussion/22443/image-texture-mode-strange-mapping-360#latest
in any other case just filp the normals of a sphere and map your 360 texture to it, i try it with other engines. with a shader you just have more control.
@GoToLoop: HBo is the best answer. :)
thank you nabr, i'll give it a try. if it doesn't work, i'll meditate - i've always known (somehow) that i'm the best answer but stil have to find out