Author Topic: Shadows  (Read 3301 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Shadows
« on: March 17, 2013, 03:40:30 pm »
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?
« Last Edit: March 17, 2013, 03:49:39 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Shadows
« Reply #1 on: March 17, 2013, 05:45:11 pm »
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.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Shadows
« Reply #2 on: March 17, 2013, 06:14:25 pm »
Cube maps are not supported ATM.
And could you do it, please? It is for shadows from point lights.

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
Code: [Select]
Object3D.setTransformListener(TransformListener tl)

Object3D.translate(SimpleVector tr){
   if(tl != null)
      lt.onTransform(...);
}
« Last Edit: March 17, 2013, 06:33:50 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Shadows
« Reply #3 on: March 17, 2013, 08:15:06 pm »
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.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Shadows
« Reply #4 on: March 17, 2013, 09:05:29 pm »
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.
« Last Edit: March 17, 2013, 09:18:37 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Shadows
« Reply #5 on: March 18, 2013, 09:26:04 pm »
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.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Shadows
« Reply #6 on: March 18, 2013, 09:43:56 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Shadows
« Reply #7 on: March 18, 2013, 10:43:50 pm »
No, but you can do something like

Code: [Select]
public class MyObject3D extends Object3D {
       
        public MyObject3D (Object3D obj) {
super(obj, true);
}
       ...
}


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