transparency mapping and fog effect

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

transparency mapping and fog effect // New Users

1  |  

Post by ultralamka // May 1, 2008, 10:35am

ultralamka
Total Posts: 2
Hello.


I need your help. I have a test scene composed of planes with transparent mapped texture:


http://sweb.cz/acl/treefog.JPG


... and I want these planes to fade into the background color with distance. But with "foreground effect shader - fog" I got this result:


http://sweb.cz/acl/tree.JPG


I can imagine it could be a common newbie problem but i can't google it out (probably language problem). I am using tS5.2. Could you please point me to the right thread/tutorial/keywords? Maybe to use the fog to achieve the result i desire is a bad idea in the first place?


Nice sunny day/sweet dreams to you wishes

Lami

Prague, Czech republic.

Post by TomG // May 1, 2008, 10:48am

TomG
Total Posts: 3397
The fog won't work with transparent planes - the distance for calculating the fog is based on the first object the ray intercepts, and not on the objects behind it, so with transparency the fog is not calculated for anything seen "through" the transparent area (or perhaps it is, but the distance is reset to start from the transparent object, giving less fog than would be expected).


You could try the Mask Distance shaders for ShaderLab here:

http://www.tmgcgart.com/ShaderLab/html/tg_pack_3.htm


Those were done in such a way that the resulting image mask DOES account for distance seen through a transmissive / transparent object. You would have to apply the fog post-process though with this approach, the shader only generates a grey scale mask, and doesnt actually calculate the fog.


Other options are making fog with objects (layers of them with high transparency, the further objects will be viewed through more of those layers and so show more fog effect).


Perhaps other folks will have other ideas too! However, using fog with alpha channels, transmission or transparency won't work directly.


EDIT:

You could also paint fog shaders on objects, may work better:

http://www.tmgcgart.com/ShaderLab/html/shader_listing_2.htm#Fog


- though these probably have the same issue of distance being taken from the transmissive / transparent object and not from the camera.

END EDIT

Tom

Post by Johny // May 1, 2008, 1:30pm

Johny
Total Posts: 672
pic
Render you scene with Rendering visibility flag set to scanline also solve you problem :rolleyes:

Post by TomG // May 1, 2008, 2:05pm

TomG
Total Posts: 3397
Now that's a cunning solution! May lose a little in quality, but at least the effect is up and running. You learn something new every day!


Tom

Post by W!ZARD // May 2, 2008, 2:03am

W!ZARD
Total Posts: 2603
pic
There's a .tsx called ZRender that renders out a greyscale image of your scene. It sees through the alpha planes very well and gives you am image you can use as a mask in PS or the GIMP. Use this mask and apply your fog using layers.


Can't recall off-hand where you can get it though sorry.


This give a very precise degree of control over the fog levels as you can see the fog get thicker as you change the layer transparency. You can also shave a lot of time off your renders this way. Doing a depth render and a colour render and compositing them in a 2d app can be faster than rendering out a colour picture with fog.


Another advantage is you can have both a ground fog AND a depth based fog in the same image (although the ground fog will upset the alpha planes in this case).


Hope this helps

Post by ultralamka // May 4, 2008, 9:49am

ultralamka
Total Posts: 2
Big thanks to all of you, dear newbie-helpers.


I got it work - but now I see the "fog effect" is not exactly i have imagined or at least, it seems to me that the "foreground shader - fog" is missing very important parameter: the distance at which the fog "starts".


Anyway, I learned a important lesson from you - the tS is a lot of math applied to every pixel of the image, but it is still only a computer counting, not a fellow human-artisan drawing. I have to think if my desired effect is "countable" at all. I will experiment around a while before I ask again .)


Wish you a beautiful sunny day (there was one today in Prague)

Lami.

Post by spacekdet // May 4, 2008, 1:53pm

spacekdet
Total Posts: 1360
pic
Right Click on the 'Foreground Effects Shader- Fog' and you should see a panel with a 'Distance' parameter. This sets the distance in meters to 100% fog. There are also two types of fog- 'regular' and 'ground'. Regular affects the entire scene evenly; 'ground' uses the 'height' parameter (measured from the grid level) to fade the fog from thick beneath and thinner above.

'Foreground Shader- Depth Cue' is similar to fog, and also has a distance 'near' and 'far' parameter that can be adjusted.

Lightworks (tS5 render engine) has an unfortunate bug with foreground shaders like fog and transparency maps.

Using your trees as an example, you could instead have a series of transparency images with some darker in value and some lighter- put the darker ones closer to the camera and the lighter ones further away and you can fake the effects of fog.

12304

Post by Nez // May 6, 2008, 2:32am

Nez
Total Posts: 1102
pic
There's a .tsx called ZRender that renders out a greyscale image of your scene. It sees through the alpha planes very well and gives you am image you can use as a mask in PS or the GIMP. Use this mask and apply your fog using layers.


Can't recall off-hand where you can get it though sorry.




I've checked the zip file for the txt file that accompanies the plug-in and it was a CK Game Factory plug-in - I gather this site is no longer on-line.


However, it muct have been one of the free plug-ins (or I wouldn't have it!) so I can't see why I couldn't send it to you?
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn