Hi, I am new on this page and I am so happy to work with BGE, but I have got a question about it. Can I have got two different shaders on two different viewports (Cameras).I want to make something like screen space reflections with 6 viewports and I want to cull some faces, which is displayed in other viewports. Is it possible? I worked with UPBGE too, but I do not know how to do that(I tried to do that with planar reflections, because it runs faster than my render to texture ,but I do not know how to set shader for viewport of planar reflection). On my GTX 1070 7 reflection planes with 1024 x 1024 and 900000 verts runs more than 300 fps without V-sync.
Thanks for your ansvers.
well yes, you can…but it would take some crazy witchcraft to produce reflections from an overlay scene since it would only generate reflections from that specific scene…but I’m sure you can also use multiple cameras with either different clipping ranges or some sort of blender mode…I’m no GURU here…hopefully someone else better versed in this can drop by and correct me…and even better, give ‘good’ advice
the only advice I have for you is to look at using ‘scene’ logic brick to a camera
Thanks for answer. I looked on the logic api, but camera has no attribute getShader() which is used with materials. I hope, that is another way to set the shader. Here is the example of minimal shader which I tried to set to camera.
import bge
cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner
for camera in scene.cameras:
shader = camera.getShader()
if shader != None:
if not shader.isValid():
shader.setSource(VertexShader, FragmentShader, 1)
but I have got this error:
Blender Game Engine Started
Python script error - object ‘Camera’, controller ‘Python’:
Traceback (most recent call last):
File “Text”, line 32, in <module>
AttributeError: ‘KX_Camera’ object has no attribute ‘getShader’
Blender Game Engine Finished
OK, Finally I have got it. Yes, It is possible, but porobably slow. You can differentiate viewports by their position. Here is my example.(Tried on upbge 0.1.8. I do not know if it works on BFBGE)
You can try it, rename the camera name to yours camera name and it will work, but pay attention, if you are writing own script, camera position must be dynamic update uniform. And remember it is only an example. It has got some bugs.
P.S.:If you heve got better solution for vector comparing, please reply.