Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Cowbox's appeal to Lost in Thought about his frustum culling port

Author
Message
C0wbox
19
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 2nd Jul 2008 15:05 Edited at: 3rd Jul 2008 20:56
@ Lost in Thought
I would have posted on your original Code Snippet thread, but due to the forum's setup, that thread is now closed so I posted here.

I'm currently using your frustum culling port in the background of my current project, Vision. Without it, Vision would be an incredibly laggy game.

I was going along fine with the production of Vision when I realised I could use a water shader infront of the camera when it was underwater, to make it look all shimmery.

So I did this and only half the level is visible when underwater because it doesn't update what it has culled out if there is an object infront of the camera.

Basically my question to Lost in Thought (or anyone else who knows what they're doing) is:
Is there a way to exclude an object from the culling procedure? - If so, how? (I want to exclude the watery shimmery FXd object from the frustum cull.)


If there isn't a way to do this, is there anything anyone can suggest that I've overlooked. :S

Thank you to anyone who actually replies to this.

EDIT:
I am aware this problem may not be the same now because I've since learnt that it is other things that are screwing the culling up.

I believe the problem is, "How do I use multiple cameras but still only cull with 1?"

Image All
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 2nd Jul 2008 20:00
I'm assuming that you're doing a full-screen effect by placing a plane with a shader on it in front of the camera so that it matches up perfectly to the edges. I will refer to this plane as the "shader plane".

Instead of putting the shader plane in front of the primary camera, put it at a stationary position in front of a second stationary camera, so that its edges match up perfectly with the edges of the view of the camera.
Hide only the shader plane for now. Put a sync mask on to only sync the primary camera. Make sure you set camera to image to render your primary camera's output to an image. Fastsync.
Now put a new sync mask so that only the secondary camera can render. Hide all objects in the scene, and then unhide the shader plane. Texture the shader plane with the image to which the primary camera renders. Apply the shimmer-shader to the shader plane to make it do its thing. Sync.
Hide the shader plane, sync mask to enable only primary camera, show all other objects again and repeat.

I think this should fix your problem, because this is how I've heard that fullscreen effects should be done.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 2nd Jul 2008 20:09
Having an object in-front of the camera shouldn't change a thing, frustum culling only culls objects that are outside of the camera's 'view frustum' hence the name, calculating if an object is visible behind another one is far more complex and probably would result in you losing speed rather than gaining any so it isn't done directly. If you wish to exclude an object from the cull check just don't call 'setup_Cull_obj()'?

C0wbox
19
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 2nd Jul 2008 20:53 Edited at: 2nd Jul 2008 21:50
@ Image All
Well, that all sounds very complicated and like you know what your talking about, but I'm afraid I've only "seen" sync mask, I don't know how to use it. And for that matter, don't understand fastsync either.

I'm also not entirely sure my game meets the criteria. As I'm only using one camera for the view. (Any other cameras are to do with the water shader effect I'd be placing infront of that camera (0).)

EDIT:
I could do with another command being explained to help me to solve this, set camera clip different variations of the variables input into this command seem to screw up the effect in different magnitudes but still overall, the culling seems to only work when you're looking at the floor.

set camera clip seems to screw up what the cameras are actually rendering, for example, that the camera controlling refraction, is set to orietate the same place as the main camera (0) but when using set camera view to see what it is seeing, its still back at the start of the level when I'm elsewhere testing the water (litterally).

I'm very confused and I'm trying to fix things I don't understand. :S

@ dark coder
I see what you're saying about the frustum culling procedure.

But it just seems that whenever I go underwater (and the shader is brought infront of the camera) all the limbs of the map stop being updated, so you're left with only what you could see before you got into the water. (So if there was a wall that you could only see from in the water, once in there, you still wouldn't be able to see it because its still culling it out from the view just before you got into the water.)

Ah, I was about to say that setup_Cull_obj isn't being called but then I realised it was, but only for the map object. So that leads me onto the opinion that it is something to do with the fact that the shader uses 2 extra cameras that are somehow corrupting what the original (0) camera is supposed to be seeing thus culling out.

Login to post a reply

Server time is: 2025-08-08 19:53:48
Your offset time is: 2025-08-08 19:53:48