frustum culling

Started by raft, January 12, 2011, 01:32:02 AM

Previous topic - Next topic

raft

have a look at the image below. in the upper part, half of tile is invisible. it's cut. is there anything to prevent this? it also happens in desktop JPCT.


Thomas.

try to set higher value in nearPlane...
Config.nearPlane = 2; // default = 1

EgonOlsen

But remember to adjust Config.glIgnoreNearPlane too. Otherwise, setting the near plane will show no effect.

Thomas.

but by default is true, is not it?

EgonOlsen

Yes...which means that the setting for the near plane will be ignored.


EgonOlsen

Just in case that somebody wonders why it is the way it is: It's a relic from desktop jPCT, where the near plane for software and hardware renderer works differently.

raft

thank you :D increasing near plane solves this issue but creates another. it behaves like fov is increased (zoom in). same applies to sky box too. i dont want this behaviour should i play with fov to compensate this or what ?

i also wonder why increasing near plane solves this rendering artifact?

EgonOlsen

Increasing? Maybe it cuts it earlier, so that it isn't noticable any more? I would have expected a decrease to help. The change in fov (it isn't exactly that, but it looks like it...) is normal behaviour when adjusting the near plane. I would try to compensate with real fov.

raft

i hadn't tried decreasing. now i tried it. it didnt help on AE and has some very weird artifacts on desktop. have a look at below images. it's more noticable in action.





i've also noticed that, when nearplane is modified, blitting location goes wrong on both AE and desktop. if near plane is decreased, blitted images move to center and vice versa. the blitted text in above images are normally 5px close to edges when near plane is default.

EgonOlsen

Try these: http://jpct.de/download/tmp/jpct_jars.zip

They should fix both issues. Adjusting the near plane is a bit of a hassle, because software and hardware renderer are behaving totally different...

raft

thanks, in desktop jPCT both issues are solved. however in AE, if near plane is modified no blits are visible. i've tried 0.9 and 1.1

btw, i still dont get how near plane value helps my original issue. and looking at first screenshot again, now it seems as rendering is correct.

raft

you have removed Config.glAvoidTextureCopies in this last AE jar, so i guess Texture.keepPixelData only determines if texture data is kept ?

EgonOlsen

Thinking about it, you might be right. As adjusting the near plane only moves everything closer or away, the clipping behaviour itself on that plane will remain the same. Personally, i think that the rendering is correct...you are moving into the geometry, so clipping is unavoidable.

Anyway, i'll look into the AE issue tomorrow. May it be useful or not, it should be fixed.

EgonOlsen

Quote from: raft on January 12, 2011, 11:32:23 PM
you have removed Config.glAvoidTextureCopies in this last AE jar, so i guess Texture.keepPixelData only determines if texture data is kept ?
Yes. Having both created a flawed logic, so i got rid of one.