Transparent textures in Blender

General debates and discussion about the Guild of Writers and Age creation

Postby Trylon » Wed Sep 13, 2006 10:23 pm

I'm afraid I must agree with everyone else here: try PNG textures first.
I must confess that I did not use anything else than PNG textures to check if that transparency works, and I never tried TGA.

I just checked to see what the plugin exactly does - It uses the blender texture file to read inevery individual pixel - builds up a raw rgba picutre from that, and potentially compresses it with DXT-5 (DXT-1 only in case of no transparency).

So as far as I can see, it must be a blender thing - appearently blender does not pass s TGA alpha information correctly to the plugin....
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Postby Branan » Thu Sep 14, 2006 6:47 am

that's... wierd. Really wierd.

Blender supports TGAs, and if you're just getting the image information from Blender, you should be able to get that just like everything else...

I'll take a look at the BPy stuff for images, and see what I can dig up.

*EDIT* looked at the BPy image stuff... can I assume you do this:

[x,y] = img.getMaxXY()

for 0 to x:
for 0 to y:
imbuf[x][y] = img.getPixelI(x,y)

Or something similar? That'll give you imbuf[x][y][0] = r(x,y); imbuf[x][y][1] = g(x,y); imbuf[x][y][2] = b(x,y); and imbuf[x][y][3] = a(x,y)

I think it will, anyway... I'm not really sure how Python handles multi-dimensional arrays, if it handles them at all. But you should be able to do something like that.

Once that's done, you just do whatever else needs to be done on the image.
Image
Your friendly neighborhood shard admin
User avatar
Branan
Gehn Shard Admin
 
Posts: 694
Joined: Fri Nov 16, 2007 9:45 pm
Location: Portland, OR

Postby Robert The Rebuilder » Thu Sep 14, 2006 8:20 pm

OK - I've taken the suggestions, and did some experiments, and here's what I've found:

- Simply changing the texture file format to PNG: still opaque
- Using the 6/2/2006 code base (last one before refactoring): still opaque
- Exporting using the "Generate Release" option in old code base: object not visible
- Exporting using the "Generate Release" option in new code base: object is transparent, but is drawn first so that no other object appears on the other side
- Add a second object that uses the texture, then export using "Generate Release" option in old code base: TRANSPARENCY!
- Add a second object that uses the texture, then export using "Generate Release" option in new code base: TRANSPARENCY!

So, the transparency works only if you have more than one object using the texture AND you select Generate Release. Without generate release, the texture is in the DirectX A8R8G8B8 DDS format, while although it does contain the alpha values (I've verified this in PRP Explorer), the Plasma engine only makes it transparent if it is in DXT5 DDS format.

Oh - and I forgot to mention: you need to delete the _TexCache when you change to Generate Release; otherwise, the cached texture is in the wrong DDS format.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Postby Trylon » Thu Sep 14, 2006 10:15 pm

[quote="Robert The Rebuilder"] OK - I've taken the suggestions, and did some experiments, and here's what I've found:

.....

- Add a second object that uses the texture, then export using "Generate Release" option in old code base: TRANSPARENCY!
- Add a second object that uses the texture, then export using "Generate Release" option in new code base: TRANSPARENCY

That's weird!

I didn't encounter that before.... were you able to check the layer settings (with prpexplorer) for your layer in both instances? They should be (kinda) set to transparency in both cases.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Postby electroglyph » Fri Sep 15, 2006 4:17 am

I haven't programmed in decades but when I did have problems with matrices it was usually because I forgot that zero was a number. If one textured object won't work but the second works with two then you probably have a flag or array size statement that needs to be changed from n=x to n=x+1.
electroglyph
 
Posts: 124
Joined: Fri Nov 16, 2007 9:45 pm

Postby Robert The Rebuilder » Fri Sep 15, 2006 9:25 am

[quote="trylon"] I didn't encounter that before.... were you able to check the layer settings (with prpexplorer) for your layer in both instances? They should be (kinda) set to transparency in both cases.

Trylon:

In all cases, the layer properties were correct (i.e. word1 was set to 2). So, that's not the problem. As far as I can tell, the problem lies in these two areas.

1. The URU Plasma engine only renders objects as transparent if the texture is in DXT5 format, which is currently only activated when texture_compress is set to 1 (via the Generate Release option). Perhaps we can make it so that any texture flagged as "useAlpha" automatically gets compressed to DXT5, regardless of the texture_compress setting?

2. The object is not placed in a separate plDrawableSpans that is dedicated to alpha-blended geometry. Ideally, the plugin would separate out any object with transparent layers into a separate plDrawableSpans. To see what I mean, examine an URU PRP file in PRPExplorer and look at the plDrawableSpans. There is at least one non-blended span (e.g. _District__00000000_0Spans) and the others are blended spans. This separation would guarantee that the alpha-blended geometry is rendered last. Without this separation, it is luck-of-the-draw whether the alpha-blended geometry is rendered first or last; somehow, making more than one alpha-blended object helps push it to the end of the span...

Thoughts?
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Postby Trylon » Fri Sep 15, 2006 10:44 pm

Robert,

to your point 1:
Added that to the plugin yesterday. Along with what I have on that other thing I was working on ;)

to your point 2:
Unfortunately, I don't know squat DrawableSpans yet, so... everything I say is basd on guesswork. - We could however save transparent objects for a tird object pass, so that they get processed last in the plugin. I don't know how to tell the plugin to make a separate drawspans but maybe someone else does.

On a side note:
Would this Drawablespans thing also account for this situation: ? (had that once) - I had a plane with a drawing and a lot of transparency hovering a few centi-/millimeter above around on a solid floor, but when it was loaded, the solid floor was made transparent too on the places where the plane should be transparent
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Postby Robert The Rebuilder » Sat Sep 16, 2006 7:04 am

Trylon:

From your description, it does sound like an ordering problem. The transparent plane above was rendered first; at the time, the solid floor below was not yet drawn, so you probably saw through the floor (which was rendered second, but behind the transparent plane). If the transparent plane was drawn last, then you would have seen the solid floor.

I'll see what I can do, since I'm pretty familiar with spans from the refactoring.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Postby Robert The Rebuilder » Thu Sep 21, 2006 6:36 am

This issue has been fixed - see the post at Alcugs:

http://alcugs.almlys.org/forum/viewtopic.php?t=215
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 46 guests