Planetside Software Forums

General => Terragen Discussion => Topic started by: Anthony Appleyard on January 27, 2014, 04:41:54 AM

Title: Transparency / opacity map trouble
Post by: Anthony Appleyard on January 27, 2014, 04:41:54 AM
I have a model of a small dredger which I made, which works well in Poser. It has its owner's name on labels along its sides. I got my Poser to export it as .OBJ + .MTL and imported it into Terragen 3 as an object in a scene.

https://en.wikipedia.org/wiki/Poser (https://en.wikipedia.org/wiki/Poser)

The hull including where the labels are, is textured with a "somewhat dirty metal" texture which I made, in material "hull".

.OBJ file format does not carry transparency information, so I had to put the transparency information back in Terragen.

The text of the label is supplied by a distinct surface, material "labels", parallel to that part of the hull and about .01 inch (as on the dredger, not as on the computer screen) out away from it, diffuse color black, transparency 1 (= 100%), transparency map image as white text on black background. This works in Poser, but I cannot make this method work in Terragen. Always the label area renders as solid black or solid white. What should I do?
Title: Re: Transparency / opacity map trouble
Post by: Dune on January 27, 2014, 05:43:43 AM
Did you call the opacity (or alpha) file in the opacity tab of the deafult shader? If you have the color of the default shader in the object part say just white, and a map in the opacity tab, where the letters are white, rest is black, and set color as opacity, or use and tick alpha channel, it should work, AFAIK.
Title: Re: Transparency / opacity map trouble
Post by: Anthony Appleyard on January 27, 2014, 10:20:08 AM
Herewith attached is an image of what I have in the material "WLabel"'s Colour and Diffuse tabs. Please what should be where?
Title: Re: Transparency / opacity map trouble
Post by: bobbystahr on January 27, 2014, 10:34:46 AM
Quote from: Anthony Appleyard on January 27, 2014, 10:20:08 AM
Herewith attached is an image of what I have in the material "WLabel"'s Colour and Diffuse tabs. Please what should be where?


You don't need Colour from Alpha with use Alpha checked. That may be the spanner in the works there...
Title: Re: Transparency / opacity map trouble
Post by: Dune on January 27, 2014, 12:25:36 PM
Well, the main culprit is the black in the opacity; it should be white!
Title: Re: Transparency / opacity map trouble
Post by: bobbystahr on January 27, 2014, 01:47:38 PM
Quote from: Dune on January 27, 2014, 12:25:36 PM
Well, the main culprit is the black in the opacity; it should be white!

D'oh...just noticed that myself
Title: Re: Transparency / opacity map trouble
Post by: Anthony Appleyard on January 28, 2014, 05:52:01 AM
I have tried various combinations, and I found that:
* If the label's diffuse color is white or black, the text on the label does not show.
* If the label's diffuse color is red (255,0,0), the text on the label does not show.

* If the label's diffuse color is dark red (128,0,0), the text on the label shows, rather faintly:-
If the transparency texture map image is white text on black background, the text shows faintly as lighter than the dark red background.
If the transparency texture map image is black text on white background, the text shows faintly as darker than the dark red background.

In Poser the transparency map image is used directly to state how transparent each bit of the label is. If each bit of the image is t% transparency, it shows as (t% of the color of whatever is behind it) + ((100-t)% of the stated diffuse color of the label, for each of the 3 color components red,green,blue.
It seems that in Terragen this combining of the label's color and the color of whatever is behind it, is done in some other way than plain addition.
Title: Re: Transparency / opacity map trouble
Post by: Matt on January 28, 2014, 07:12:25 AM
It should work if you take the settings you have in the screenshot except:

Translucency: You probably don't need this, so set it to 0
Translucency image: You probably don't need this.
Opacity: 1, white
Use alpha channel: OFF
Alpha from  colour: OFF
Images tab -> Unpremultiply colour: You may need to experiment with this ON or OFF.

Your opacity/transparency image should have white text on a black background.

If you're supplying an image for the transparency/opacity, don't use "alpha from colour" - that's a special trick which works like a green-screen or blue-screen keyer which you can try if you don't have a separate image. Use as a last resort if you don't have an opacity map.

If you have a dedicated transparency/opacity image with the opacity information in the RGB or greyscale channel(s) (which it sounds like you do), then don't use "use alpha channel". You'd use that if the opacity information is stored in the alpha channel if your image, e.g. you might have a diffuse colour image with its own alpha channel.

Make sure the Opacity value is 1, and white. Any opacity image or opacity function you supply is multiplied by this value, so in most cases you need it to be at 1 so that the fully opaque parts of the image remain fully opaque.

Finally, be aware that Terragen currently can't render intermediate shades of grey transparency. Every pixel (or subpixel) of the object is either fully opaque or fully transparent. Lighter pixels will be converted to white; darker ones to black. This usually isn't a big problem, but it's something we should handle better in future.

Matt
Title: Re: Transparency / opacity map trouble
Post by: Anthony Appleyard on January 28, 2014, 08:24:19 AM
Thanks, it worked (render attached), but the opacity image had to be white text on black background.

On the labels, the strokes of the writing are narrower then in the opacity image, i.e. the transparent parts have invaded the opaque parts a bit. (The opacity image is .bmp .)

In Poser, one internal Poser length unit is about 100 inches. If I export an object from Poser as .OBJ + .MTL, and import it into Terragen, how big is one Terragen distance length unit compared to the Poser measurements?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re the image :: You and your mates go to one of your usual scuba diving sites, but someone who claims to control access to the water has hired one of these as a patroller. It is about 43 feet long and can submerge (duck-dive) briefly.
Title: Re: Transparency / opacity map trouble
Post by: bobbystahr on January 28, 2014, 03:05:19 PM
Unless it is a percentage thing, all measurements in TG are metric ie: 1=1 meter
so your craft would be 13.1064 meters