Shadows

Started by Thomas., March 17, 2013, 03:40:30 PM

Previous topic - Next topic

Thomas.

Shadows are working now. But I ran into a few problems...
How can I set cube map?
Please, could you implement transform listener (this I can not do from my side) and do public method for finding visibility of objects in view frustum? I want update depth texture only, where it is needed.
You probably somewhere parse GPU extension. Please, could you do method for getting extensions public? Otherwise, how can I find which extensions GPU have?

EgonOlsen

Cube maps are not supported ATM. What is a transform listener supposed to do and why do you need the information about visible objects to update the depth texture? A method to get the supported extensions should be available in the gl API. It doesn't belong into the engine IMHO.

Thomas.

#2
Quote from: EgonOlsen on March 17, 2013, 05:45:11 PM
Cube maps are not supported ATM.
And could you do it, please? It is for shadows from point lights.

Quote from: EgonOlsen on March 17, 2013, 05:45:11 PM
What is a transform listener supposed to do and why do you need the information about visible objects to update the depth texture?
The method that is called when object performed a transformation. I want to update the shadow map only, when some object in view frustum of the shadow projector moves or rotates.
About TransformListener

Object3D.setTransformListener(TransformListener tl)

Object3D.translate(SimpleVector tr){
   if(tl != null)
      lt.onTransform(...);
}

EgonOlsen

Oh boy...shadows from point lights...isn't that a bit overkill? Anyway, i'll look into it but i can't say when it's going to be added. I'm quite distracted from coding ATM...

About that listener....i still don't see the point. Doing that would increase the frame rate in situations where nothing moves. What's the point of that? It doesn't matter if a static scene renders at 10 or at 50fps or am i'm missing something? Apart from that, i can't detect such a change without storing some backup matrices and doing some matrix compares each frame.

Thomas.

#4
I do not need cube texture now. If it is hard to implement, do not do it. Shadows from point lights will be very expensive especially on mobile GPUs. Now for me have a higher priority game elements than effects.

Shadows. It depends on what you mean static scene. I think, it is very big difference. Shadow map from light can be updated only, when some object in view frustum of the shadow projector or projector performs a transformation. In other cases can be the same and camera can move in the scene without updating shadow map. I think it would be enough calling onTransform() method when is called some of the transformation methods like translate(...), rotateX(...)... and input is not zero. Other optimization can be render in small part of texture only. If object, that performed transformation is only one, rendering can be perform in the part of texture where AABB of object occupies.

EgonOlsen

No idea if it's hard or not, but i would be glad to post-pone it for some time. I'm quite busy ATM with some private life stuff.

For that listener: I see your point, but i suggest to override Object3D and add this logic yourself. It just doesn't feel like something that belongs into the engine itself to me. In almost all real world cases, this optimization doesn't apply. It only applies if the scene is tiny and static.

Thomas.

What you mean by override Object3D? I can not create my class and extend Object3D, I tried it, but myClass = Loader... not working after that.

EgonOlsen

No, but you can do something like


public class MyObject3D extends Object3D {
       
        public MyObject3D (Object3D obj) {
super(obj, true);
}
       ...
}


MyObject3D obj=new MyObject3D(Loader...);