Planetside Software Forums

General => Terragen Discussion => Topic started by: moodflow on November 13, 2008, 07:54:02 AM

Title: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 13, 2008, 07:54:02 AM
I'm not sure if this is a bug or not, but I have a 2D billboard object that simply will not project a shadow.  Would anyone else have any insights on this?

Files are attached.

Title: Re: 2D Billboard Object - no shadows rendered
Post by: sjefen on November 13, 2008, 08:46:39 AM
Is it 2-sided?

- Terje
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 13, 2008, 12:36:07 PM
I "assumed" it was, but you might be right... maybe its only 1 sided! 
Title: Re: 2D Billboard Object - no shadows rendered
Post by: Matt on November 13, 2008, 01:30:40 PM
I've tried it and it looks like there is a bug we'll need to fix.

Matt
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 13, 2008, 11:58:12 PM
Quote from: Matt on November 13, 2008, 01:30:40 PM
I've tried it and it looks like there is a bug we'll need to fix.

Matt


Or maybe a bug.  ;-)
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 14, 2008, 07:11:41 AM
I loaded the obj into Poseray and it displays an error when you try and add an image to the material.

http://forums.planetside.co.uk/index.php?topic=1477.msg14731#msg14731 (http://forums.planetside.co.uk/index.php?topic=1477.msg14731#msg14731) contains a good object for billboard trees
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 14, 2008, 09:25:22 AM
Hi BigBen,

Unfortunately, this file doesn't display any textures attached to it properly.  They are unusually dark, and it requires you use luminosity (which emits light), rather than diffuse color (which would just reflect ambient light).  You can try boosting the diffuse color by increasing the number and this does not resolve the issue with that model.  It took me forever to figure this out.  There is something wrong with the way its trying to display the image, which is inherent in the model itself.

The obj I posted works perfectly, other than not casting a shadow.  But as Sjefen stated, it may be a 1 sided object, or as Matt stated, might even be a bug in TG2.

We definitely need a "working" billboard object (or built in system in TG2 for this).  Though I know TG2's popular works nicely with 3D objects, having the ability to use 2D objects opens up even more doors.  I know there was mention this might possibly be included in future releases (or at least that was the gist I got). 
Title: Re: 2D Billboard Object - no shadows rendered
Post by: Mohawk20 on November 14, 2008, 11:54:45 AM
Wouldn't it be easiest just to make it possible to rotate the internal plane object?
Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 14, 2008, 07:35:32 PM
You can rotate the plane. The vector edge (A-B) boxes control it. To flip a plane (so you can render it from below, you can't see it from above this way, TG2 planes seem to be one sided) just alternate the default values in the 'X+Z' parameters. Zeros for ones and ones for zeros. Raise it above the camera to see the surface.

To tilt it use the 'Y' values. '0.1' is a small tilt, '90' is full vertical. :)

[attachimg=#]

[attachimg=#]

[attachimg=#]

EDIT:

I've already tried the 'underwater' camera ;)... It still doesn't work. :(
Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 14, 2008, 07:55:52 PM
I note a couple of issues using planes in a population... One half-plane near the front, I wonder if microvertex jittering would help this? Nope, it doesn't.

Maybe more importantly, no shadows, just like the object above.

[attachimg=#]
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 14, 2008, 08:11:14 PM
Thanks everyone for looking into this.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 15, 2008, 06:35:13 AM
Quote from: moodflow on November 14, 2008, 09:25:22 AM
Hi BigBen,

Unfortunately, this file doesn't display any textures attached to it properly.  They are unusually dark, and it requires you use luminosity (which emits light), rather than diffuse color (which would just reflect ambient light).  You can try boosting the diffuse color by increasing the number and this does not resolve the issue with that model.  It took me forever to figure this out.  There is something wrong with the way its trying to display the image, which is inherent in the model itself.


Had another look at this object. 
[attachimg=#2]

Try turning off smooth normals (not needed anyway)
[attachimg=#1]

The object is set up with luminosity to reduce the shadows the object casts on itself which can make it look a little odd when seen close up with the ligh behind the camera.  In the sample images I set luminosity to 0 and colour intensity to 0.5.

The advantages having 2 perpendicular planes are that the shadows are more realistic and they work well in an animation. The luminsoity was probably set to try and reduce the shadows that the object casts on itself with the sun behind the camera. (see the foreground trees to the left and right in the image above)
Title: Re: 2D Billboard Object - no shadows rendered
Post by: Mohawk20 on November 15, 2008, 07:03:11 AM
Quote from: dandelO on November 14, 2008, 07:55:52 PM
I note a couple of issues using planes in a population... One half-plane near the front, I wonder if microvertex jittering would help this? Nope, it doesn't.

Maybe more importantly, no shadows, just like the object above.


Only that one in the front has a shadow...


And for the underwater camera, try what happens if you flip a plane upside down, and apply the water shader to that... You won't get the right lighting I'm afraid, but that might be 'fixable' with lights?
Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 15, 2008, 07:41:08 AM
The one in front is the population object maker, the original model. The others are instances that aren't casting shadows. At least Moodflow's issue seems to be resolved though.

QuoteAnd for the underwater camera, try what happens if you flip a plane upside down, and apply the water shader to that... You won't get the right lighting I'm afraid, but that might be 'fixable' with lights?

That's what I was meaning I'd already tried up there, Mohawk. ^^. It doesn't work with this method. ;)
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 15, 2008, 04:42:15 PM
I duplicated the object shader from the 2D card object in my post above and applied it to a population of TG planes to get this:
[attachimg=#1]

Which consists of  single shadow of the master object.  Do TG planes support UV mapping?  Applying the same shader to a sphere works as expected.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 16, 2008, 11:17:53 AM
Unfortunately, DandelO, this issue is still not resolved.  With the 2D card object, it does cast shadows, but the texture is too dark.  At this time, I am assuming its due to an object flaw.  Even with diffuse color set to 1, the object renders too dark (see below). 

The other 2D object I have shows the image perfectly, but does not cast shadows.

Below, I've attached a sample image of the "darkness" and the 2D card object, plus the test image I've been using.

The main reason I am pursuing using a 2D object, is for extremely massive populations.  I've been working on one image that consistently crashes, due to sheer volume of 3D populations.  In certain cases, the difference between 2D and 3D is negligible, so I've decided to go this route in certain cases.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 16, 2008, 11:33:46 AM
I've put this here before, but this is a good way to postwork distant scenery - http://www.gardenhose.com/
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 16, 2008, 03:52:17 PM
Quote from: moodflow on November 16, 2008, 11:17:53 AM
Unfortunately, DandelO, this issue is still not resolved.  With the 2D card object, it does cast shadows, but the texture is too dark.  At this time, I am assuming its due to an object flaw.  Even with diffuse color set to 1, the object renders too dark

Quote from: bigben on November 15, 2008, 06:35:13 AM
...
Try turning off smooth normals (not needed anyway)
Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 16, 2008, 04:38:36 PM
I often do use 2d trees, they use far less render power when it's for huge, distant populations. Works well.
The object I apply the texture to, however, is a flattened cube, not a one or two-sided plane object. Try using a flattened cube primitive and apply the same textures to it as you have your 2d plane. My snowflake .tgo is just a flat cube with colour and opacity aswell and I need to uncheck 'cast shadows' for it because they cast correctly, from every instance.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 16, 2008, 04:55:21 PM
Quote from: dandelO on November 16, 2008, 04:38:36 PM
I often do use 2d trees, they use far less render power when it's for huge, distant populations. Works well.
The object I apply the texture to, however, is a flattened cube, not a one or two-sided plane object. Try using a flattened cube primitive and apply the same textures to it as you have your 2d plane. My snowflake .tgo is just a flat cube with colour and opacity aswell and I need to uncheck 'cast shadows' for it because they cast correctly, from every instance.

This is a great idea!  I assume transparent .tiff files would show through properly?
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 16, 2008, 04:56:22 PM
Quote from: calico on November 16, 2008, 11:33:46 AM
I've put this here before, but this is a good way to postwork distant scenery - http://www.gardenhose.com/


Calico, this is one of the main reasons I want to get this 2D object going.  Paint together some gardenhose elements, and create a 2D image out of them.  Great stuff!
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 16, 2008, 05:00:09 PM
Hi BigBen,

I turned off smooth normals, and still no luck.   ???
Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 16, 2008, 05:31:35 PM
Any image type will work for opacity, as long as it's black/white. I use .jpg mostly for this as they are small in size and if it's this far away you don't need really high quality images. Black=transparent/colour=opaque.

Here's my snowflake object, it has cast shadows left on, you'll want to disable that if it's used in a floating population. It only uses one image in a default shader because it doesn't contain any other colour...

Use the default shader(as I've done here) or, for more control, use an IMS, leave 'transparency key'=black and adjust the 'key tolerance' levels, very slightly, until you have the correct opacity.
I'll be back with more on this shortly, namely trees with one colour image-map that uses the same image for opacity(if I can find my trees, I've a feeling I've left them on another disk...)

[attachimg=#]





Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 16, 2008, 06:14:14 PM
Right, here's how I do it...

First I make a new plane object of the aspect ratio of the image map - 3/4. Import that into TG.
Next I make a new IMS in it's internal network and I leave projection as 'through camera', for now, this is for ease of editing as you'll see from these test images. Once you're finished editing colours/opacity, switch to 'object UV' option so the image fits your plane.

First image:

[attachimg=#]

The IMS default settings without transparency show a black background behind the tree, this is obviously my background from rendering the tree-map(it's a simple tree rendered in Carrara against a black BG and saved as .jpg, no opacity channels here).
______________________________________________________

Second image:

[attachimg=#]

I want to make the black bits see-through so I enable transparency but the default 'key tolerance' of '0.1' gives too much transparency because the tree is very dark itself.
______________________________________________________

Third image:

[attachimg=#]

By keeping the 'transparency key' black and tightening the tolerance levels you can make just the black areas vanish, leaving just colour.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: Mohawk20 on November 16, 2008, 07:02:17 PM
Nice... Now we only need a proof of concept on a pop with shadows.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: dandelO on November 16, 2008, 07:11:16 PM
[attachimg=#]

:)
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 16, 2008, 09:45:57 PM
Quote from: moodflow on November 16, 2008, 05:00:09 PM
Hi BigBen,

I turned off smooth normals, and still no luck.   ???

Hmmm... weird... something else perhaps?  Try substituting your image into this?...

OK here are my files with a few tests using cbalaskas 2d card object.  LZW compressed tiff with transparent background. Disabled the second plane by making it opaque.

[attachimg=#1]
Image appplied via default shader, opacity = alpha channel of image.

[attachimg=#2]
Image applied via image map shader, opacity = alpha channel. Dare I state the obvious.... square shadows. The default shader is definitely the one to use here.

One advatnage of LZW TIFs is that you don't get JPEG artefacts which (theoretically) makes for higher quality transparency masks when creating transparency from a colour range... but it's also far easier just to have the transparency in the image as well.

I tried several different combinations of image settings with the built in plane object but no joy. Looks like a UV mapping issue with the plane objects.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 16, 2008, 10:05:01 PM
@moodflow: I had a play with your tgo and tif and it works fine. Is there another setting in TG2 that you've altered from the default?.

[attachimg=#2]
Don't forget this angle is looking into the sun

[attachimg=#3]
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 17, 2008, 10:13:38 AM
BigBen,

This looks like its working, but you did keep luminosity at 0, right?

For my case, I kept all settings default.  This is really wierd.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 17, 2008, 03:10:18 PM
luminosity = 0. The attached TGD is what I used to render your texture.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 17, 2008, 04:17:10 PM
I just downloaded what you have here, Ben, and it didn't work.  I get nothing.  Just a blank terrain.  I have all of the files in place.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: bigben on November 17, 2008, 08:31:37 PM
I just downloaded all of the files at work and get the same result.

the tgd, 2d card.tgo, 2D-tree.tif (from moodflow's first post). Here's a zip with everything in one file.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 18, 2008, 11:27:51 AM
Thanks Ben.  This one worked.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 18, 2008, 04:49:11 PM
I'll check this out when I get home.  Many thanks BigBen and Calico.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 19, 2008, 10:04:59 AM
Thank you, Moodflow.  This is brilliant work on your part and the collaborative effort of others (not me by much) has made something that has lingered as just too much trouble a reality. 

Here is my small contribution - http://forums.planetside.co.uk/index.php?topic=5218.msg53986#msg53986
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 19, 2008, 12:44:50 PM
Here's a problem.  Rendered by itself, I get that beautiful bright green image.  The same TGO in a population renders those ugly dark things.  Any ideas or is this a population bug?  This is consistent behavior moving from an object to a population so far. 
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 19, 2008, 01:04:41 PM
I got the same.  I'll take a look.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 19, 2008, 01:08:15 PM
OK, as BB had stated, it IS the smooth normals option.  Its on by default, but needs to be turned off. 
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 19, 2008, 01:09:03 PM
Moodflow, let me know what you find, but I wouldn't tear your hair out if you see nothing.  I haven't seen any differences in the TGO.  Anyway, if you want, let's put this into the Support group, unless you understand what the jump from good to crap is.

[edit - spoke too soon.  Removing the Smooth Normals is the fix.  Cool. ]
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 19, 2008, 01:51:44 PM
Here is a test image I created using this "fixed" method.  It shows the power of this option for distant foliage.  This image rendered without a hitch and this was a pretty sizeable population.  The closer up foliage doesn't look as good, but still, this will work perfectly.  I disabled the "front" face, so this is only a 2D object, with all facing the camera.  It should look better with more variation.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 19, 2008, 01:56:44 PM
Quote from: calico on November 19, 2008, 01:09:03 PM
...but I wouldn't tear your hair out if you see nothing.  

Well if I had hair, it would be a problem, LOL.
Title: Re: 2D Billboard Object - no shadows rendered
Post by: moodflow on November 19, 2008, 01:58:49 PM
Keep in mind, this method would work just as well up close, but at a micro-scale, like tiny weeds and such (and you wouldn't have to use a memory intensive 3d model).
Title: Re: 2D Billboard Object - no shadows rendered
Post by: rcallicotte on November 19, 2008, 02:32:09 PM
Moodflow, this is perfect in my estimation.  Thank you so much for contributing to our ability to do this.  As a matter of fact, I had just forgotten about this and your work on 2D objects has opened up a whole lot of doors I hadn't been thinking about.

Thanks.