Rare Graphics Glitch

Blitz3D Forums/Blitz3D Programming/Rare Graphics Glitch

Stevie G(Posted 2006) [#1]
Hi,

Following on from my collision problem in a previous thread ... re my Vehicle physics engine.

On the odd occasion the vehicle will kind of flash and some parts appear to be inside out. I say "appears" because it's so fast and rare that I've never been able to capture an image of it. This happens regardless of the camera view being close or far from the vehicle. I'm using 32 bit depth and the camera near and far range are proportionate to 1..1000, in fact slightly more accurate, so I can't imagine it being a z-order issue .. especially when most of the time all is fine.

I'm hoping that this is a driver issue as I've been unable to pin it down for months and have no issues with other b3d programs. I'm loathe to update my drivers too incase anything else is knocked out. Being a bit of a perfectionist it's extremely annoying and I can't help thinking it's something simple.

Unless anyone has any suggestions or have experienced similar then I'll have to ask all to look out for it when I release the next demo in a few weeks.

Cheers
Stevie


puki(Posted 2006) [#2]
I have seen a problem like that when using 'EntityAutoFade' - you are probably not using it but it could occur if you are manipulating 'EntityAlpha' somewhere in your code.

Other than that - no idea.


Stevie G(Posted 2006) [#3]
Cheers "Puki"

I don't use entityautofade but I am using a camerafog which I would image applies alpha automatically to distant objects. The near / far fog range is quite a bit away from the main view right enough.

I'm using vertex color enabed on all my meshes as I don't want to use any textures for a unique look. I wonder if this effects the fogging?

I'll try turning off the fog and see what happens.

I'm open to any other suggestions as I can't try anything until later :)

Cheers
Stevie


Ross C(Posted 2006) [#4]
I've seen this happen, when you set a minus value for the fog. I bet it's the fog that's causing the problem here.


Stevie G(Posted 2006) [#5]
Cheers Ross.

Hmmm. My fogrange is 800..1000 so surely the range can't be the issue. If it's the fog then is there a way around it? I need to avoid the dreaded popup if I can so not sure if I can omit it altogether .

Stevie


RGR(Posted 2006) [#6]
From experience, the first thing that came into my mind when I read your post.
.. especially when most of the time all is fine.

Does the program render to the backbuffer?
.


Stevie G(Posted 2006) [#7]
It's 3d so I would assume so? What were you thinking about?

I do have 2 x shadow renders going on. I render them from a shadow cam which is far from the main scene then copy them from backbuffer to texturebuffers. The main camera is set to cameraprojmode 0 while this is happening and the shadow camera is set to cameraprojmode 0 when it's finished.

Please help me :)

Stevie


Ross C(Posted 2006) [#8]
Have you tried just hiding the cameras? Are you using render tweening?


Stevie G(Posted 2006) [#9]
I'll try hiding them. Not using render tweening though.

Stevie


Ross C(Posted 2006) [#10]
Does the problem go away when you hide the fog? Also, is the fog only on the main camera?


Stevie G(Posted 2006) [#11]
Tried turning off the fog ... still the same problem ... only once every couple of minutes .. sometimes longer.

I also tried hiding the cameras and same problem.

I tried turning the shadows off fully and again .. same problem.

Why Why Why!!!!

Stevie


Ross C(Posted 2006) [#12]
So, it must be to do with the two renders then. Do you have the problem when you use the one render?

Another point to consider. Are you using EntityOrder at all?


Stevie G(Posted 2006) [#13]

So, it must be to do with the two renders then.



I don't think so ... it's the shadows which use two renders to texture. If I turn them off completely then same problem. I don't think only doing this once will make a difference ... besides I need both renders.

Oh, and I'm not using entityorder on any mesh in the game - I know that disables z-order.

Unless anyone has any further suggestions then I'll see if others experience the problem and package up a quick demo for the weekend.

Thanks to everyone for their advice and help so far. Still racking my brains about this!!

Stevie


Ross C(Posted 2006) [#14]
How about taking out the FlipMeshNormals() function?

Function FlipMeshNormals(mesh,num=rand(0,1000))

   If num = 5 then FlipMesh mesh

End Function


:P Honestly though... it is a strange problem. Have u tried other versions of Blitz3d?


Stevie G(Posted 2006) [#15]
Hehe, it certainly feels like there's an invisible flipmeshnormals function in there :)

Problem occured using 1.87 and again with 1.96. I'm gonna have to go back a few versions to see how far back it started happening :(

It's a bugger when it only happens once in 2-5 mins!!

Cheers Mr C


RGR(Posted 2006) [#16]
It's 3d so I would assume so? What were you thinking about?

I were thinking you forgot to code SetBuffer BackBuffer()
Because ... afaik it renders to the frontbuffer as long as you don't use SetBuffer BackBuffer()
And rendering to the frontbuffer often has the effect of rare glitches as you call them.

{Edit} I just looked into the Manual again ... well ... it says RenderWorld renders to the backbuffer by default ... while under SetBuffer it says ... the default buffer is the frontbuffer.
Cameras render to the BackBuffer only as well ...

It is just the case that I noticed forgetting to use SetBuffer caused graphics errors ... can't remember if this was in 3D or in 2D only ... maybe when I used 2D GUI/HUD on 3D screen


Stevie G(Posted 2006) [#17]
@ RaGR,

I've never had to set up the backbuffer this way on any of the hundreds of 3d programs I've written in B3d ... only 2d stuff as you say.

I just wish it happened more often so it'd be easier to trace. I'm gonna trawl though older versions of the program and see where it all went to shit. Hopefully it wasn't always there.

Cheers again
Stevie