Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,502,151
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-29-24 08:09 PM
Guest: Register | Login

0 users currently in Computing | 1 guest

Main - Computing - Seeing through solid objects in OpenGL New thread | New reply


HyperHacker
Posted on 04-05-07 08:35 AM Link | Quote | ID: 23532

...
Level: 73

Posts: 237/1220
EXP: 3367698
Next: 118170

Since: 03-25-07
From: no

Last post: 6094 days
Last view: 6078 days
Having some trouble with alpha blending in OpenGL. Here there is an object in front of this wall, but I've switched it to wireframe so we can see the wall behind it. The object is alpha-blended, but the wall is not.


Now when I switch wireframe off, we can see the object, but for some reason in the areas that are transparent, we see right through the wall behind it too!


So, uh... wtf?

Cellar Dweller
Posted on 04-05-07 06:15 PM Link | Quote | ID: 23682


Snifit
Level: 39

Posts: 17/287
EXP: 385291
Next: 19480

Since: 02-19-07
From: Arkansas

Last post: 4055 days
Last view: 3222 days
Are you making sure to draw the alpha blended objects last? It looks like you are drawing the alpha blended object before drawing the wall. This causes the depth buffer to be set at the depth of the alpha blended object, and then the wall fails the depth test and is not shown.

HyperHacker
Posted on 04-06-07 08:49 AM (rev. 2 of 04-06-07 08:53 AM) Link | Quote | ID: 23990

...
Level: 73

Posts: 246/1220
EXP: 3367698
Next: 118170

Since: 03-25-07
From: no

Last post: 6094 days
Last view: 6078 days
Hm, I thought having depth testing on would take care of that. Does that mean if I have one blended object in front of another, and any object behind that, they won't show up correctly?

Anyway thanks, that got it. Now I just need to figure out the damn format of these textures. Seems to be 4 bits of red, green, blue and alpha, but I haven't got them showing up correctly yet...

Cellar Dweller
Posted on 04-06-07 05:21 PM Link | Quote | ID: 24067


Snifit
Level: 39

Posts: 18/287
EXP: 385291
Next: 19480

Since: 02-19-07
From: Arkansas

Last post: 4055 days
Last view: 3222 days
Multiple alpha blended objects will show up correctly if they are drawn back to front. I don't think its worth the trouble to do that for a N64 game viewer/editor, as alpha blended objects seem to be used sparingly, and the N64 has the same alpha blending limitation.

This is all because after an alpha blended object is drawn, the renderer doesn't have enough information to blend another object in behind it.

GuyPerfect
Posted on 04-07-07 01:01 AM Link | Quote | ID: 24161


Paratroopa
Level: 30

Posts: 12/155
EXP: 152641
Next: 13228

Since: 03-14-07

Last post: 6048 days
Last view: 5997 days
It's important to rememebr that blending is NOT the same as transparency; it's a technique used to simulate transparency. A solid pixel takes the COLOR of its source and destination pixels in the buffer, and depth testing would make any pixel drawn behind it, well... not drawn to the buffer. I hope that makes sense.

But like Cellar Dweller mentioned, draw everything back-to-front when alpha blending in order to adequately display objects that need to appear transparent.

HyperHacker
Posted on 04-07-07 07:14 AM Link | Quote | ID: 24280

...
Level: 73

Posts: 259/1220
EXP: 3367698
Next: 118170

Since: 03-25-07
From: no

Last post: 6094 days
Last view: 6078 days
OK, thanks. Now to figure out how I'm going to implement that. Rainbow Road is completely blended, and eventually I'm going to want to do things not related to N64 games...

BMF54123
Posted on 04-10-07 11:19 AM Link | Quote | ID: 25448


Buzzy Beetle
Level: 44

Posts: 168/375
EXP: 575456
Next: 35829

Since: 02-19-07
From: [citation needed]

Last post: 6089 days
Last view: 6089 days
So, does all this explain why overlapping translucent objects in N64 games seem to be drawn in the wrong order (i.e. you can see Rainbow Road's star railing clearly through the underside of the road)?

____________________
[citation needed]

GuyPerfect
Posted on 04-12-07 02:08 AM Link | Quote | ID: 25907


Paratroopa
Level: 30

Posts: 18/155
EXP: 152641
Next: 13228

Since: 03-14-07

Last post: 6048 days
Last view: 5997 days
I think Rainbow Road's star rail is actually drawn to the buffer with depth testing disabled... or maybe the track portion is... or maybe the depth buffer is cleared between the two... There's any number of explinations, but it's depth-test related instead of blend related.

Ah, the intricacies of 3D graphical development. It's one of the only forms of programming that's like an art. Some people become very proficient with graphical tricks, while others still think that the objects are solid...

Main - Computing - Seeing through solid objects in OpenGL New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.023 seconds. (321KB of memory used)
MySQL - queries: 57, rows: 73/74, time: 0.016 seconds.