CameraClsMode zbuffer questions
Blitz3D Forums/Blitz3D Programming/CameraClsMode zbuffer questions
| ||
So: CameraClsMode camera,0,0 What does not clearing the zbuffer give me??? All I see when I do two cubes is parts of the cubes with a ton of black pixels all over them (image looks like crap)... Does anyone have a good example of where not clearing the zbuffer on a render would come in handy? |
| ||
It's useful for multipass rendering effects, so that subsequent renders will be correctly zbuffered. |
| ||
But why does it come out all grainy? I would think that if I just render a cube with it, that I shouldnt get all sorts of black pixels all over the place. |
| ||
Yeah, that's weird. Post a screenshot? |
| ||
argg... cant ftp to my server from work (our firewall is blocking me)... See if I can find somewhere else to upload the images to [UPDATE] yeah, I cant get out on port 21 at all.... |
| ||
Here is the code anyhow: This will put the cubes on the back buffer in the order they are rendered: Graphics3D 800,600,32,2 SetBuffer(BackBuffer()) Cam1 = CreateCamera() CameraClsMode cam1,0,1 light = CreateLight() Cube = CreateCube() PositionEntity(cube,0,0,5) While Not KeyDown(1) ;TurnEntity cube,1,2,3 PositionEntity(cube,0,0,5) EntityColor(cube,255,0,0) RenderWorld() EntityColor(cube,255,255,0) PositionEntity(cube,.5,0,6) RenderWorld() Flip Wend End Where as this should put them on the back buffer in order of their z position, which should put the yellow cube behind the red one, but I get some nasty grainy image: Graphics3D 800,600,32,2 SetBuffer(BackBuffer()) Cam1 = CreateCamera() CameraClsMode cam1,0,0 light = CreateLight() Cube = CreateCube() PositionEntity(cube,0,0,5) While Not KeyDown(1) ;TurnEntity cube,1,2,3 PositionEntity(cube,0,0,5) EntityColor(cube,255,0,0) RenderWorld() EntityColor(cube,255,255,0) PositionEntity(cube,.5,0,6) RenderWorld() Flip Wend End If I could post a screenshot, I would :-) |
| ||
this didn't work on my machine too, tho I don't get grainy stuff, but my yellow cube if black, invisible, but not transparent. well, it seems for the very first frame rendered it's kind of displayed, but then is disppears. Look slike a driver issue. I got a radeon 9200se, maybe an Ati thing? |
| ||
Works fine for me - I see a red cube with a yellow cube behind it. Using Win98SE on a Geforce 2 MX with old drivers (45.23) Although I don't have much knowledge as to what it could be used for...yet |
| ||
Win XP with Intel 865G video (up to date drivers) I will post a screen shot when I get home. |
| ||
I think this is the right way to go about it... Or am I missing something... If you never clear the z-buffer or backbuffer, they might contain random data...Graphics3D 800,600,32,2 SetBuffer(BackBuffer()) Cam1 = CreateCamera() light = CreateLight() Cube = CreateCube() PositionEntity(cube,0,0,5) While Not KeyDown(1) ;TurnEntity cube,1,2,3 PositionEntity(cube,0,0,5) EntityColor(cube,255,0,0) CameraClsMode cam1,1,1 RenderWorld() EntityColor(cube,255,255,0) PositionEntity(cube,.5,0,6) CameraClsMode cam1,0,0 RenderWorld() Flip Wend End |
| ||
If you never clear the z-buffer or backbuffer, they might contain random data... Bingo!Put a single RenderWorld before the CameraClsMode and it should work fine. |
| ||
I think this is the right way to go about it... Or am I missing something... If you never clear the z-buffer or backbuffer, they might contain random data... That's a good point. When doing multipass rendering where you'll want to render without clearing the z-buffer, you do clear the z-buffer on the first render every frame. |
| ||
I thought I posted the screenies, but i must not have hit submit (was very tired this morning) This is the first bit of code which is correct: ![]() This is the second bit of code, which should have the yellow cube behind the red cube: ![]() And here is the same second bit of code tested at home on my geforce7800 gt ![]() So you can see, its not just the intel865, its the geforce7800 as well.... |
| ||
That's a good point. When doing multipass rendering where you'll want to render without clearing the z-buffer, you do clear the z-buffer on the first render every frame. hmmm, I will give this a try tonight |