SC4 Devotion Forum Archives

SimCity 4 General Discussion and Tutorials => Tips, Tricks and Tutorials => Tutorials on Custom Content Creation => Topic started by: SimFox on April 17, 2009, 09:09:13 AM

Title: Casting shadows on props
Post by: SimFox on April 17, 2009, 09:09:13 AM
I have a little moding request concerning Voltaic Roundabouts


(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg401.imageshack.us%2Fimg401%2F5174%2Fkreiselfueller01.jpg&hash=3a58f0d7ed3c858b3d30af669dd7ea83d56edd07)
I think the props have to be set NOT to be ground modles that way they would receive shadows from the game objects (including the trees placed on them in LOT editor and be blending FAR better into the game. Now the fact that there is no shadows under the tree, but then it starts on the road is totally unneessary eyesore.
I've tried to do said alteration for the files already merged into DAT, but it doesn't work.
Actually if you examine those it is a mess FSHs don't match the modles, etc... It all works in game however, but as I've said changing the IsGroundModel property has no effect...
So I believe that original should be moded properly and then merged into single DAT again...

Hope I was somewhat intelligible in what I've said...
Title: Casting shadows on props
Post by: exziviben on April 17, 2009, 11:39:55 PM
SimFox:
The tree cannot show shadow on props. Andreas can say more them if he is back in a few days.
Title: Casting shadows on props
Post by: SimFox on April 18, 2009, 09:10:26 AM
Actually it can if moded properly...
I would have done it myself but the files in the DAT are messed up...
Title: Casting shadows on props
Post by: Andreas on April 18, 2009, 11:56:14 AM
SimFox, to my knowledge, props cannot cast shadows on other props, at least it didn't work in my tests. I set the "Is Ground Model" property for the roundabout props to "false", but the shadow of the tree was still "cut off". What do you mean by "properly modded"? I don't know why the S3D files are messed up in the Reader display, but the models itself should be fine, as I haven't touched them other than merging the files into a DAT.
Title: Casting shadows on props
Post by: SimFox on April 18, 2009, 12:36:29 PM
the fact that display in Reader is messed is an indication of the fact that there is something wrong with either the file or with the way Reader can access it.

Proper modng is, in fact setting that property to False, nothing more to it really... In that case prop doesn't cast shadow but receives one instead.

here is an example of the roundabout I've made (just because  of that problem with SFBT one):

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fs47.radikal.ru%2Fi116%2F0904%2F4f%2Ff1288e845242.jpg&hash=0c2ce59a8a7092f1a35e7b572a822964c1ae7adc)
as you can see the tree casts the shadow onto the filler prop as well as on the road.

and here is example as it interacts with other lots. See the shadow of the building that falls onto the roundabout filler prop.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fs57.radikal.ru%2Fi156%2F0904%2Fec%2F3fe2f5d5aabb.jpg&hash=b8b39d91d1bc21dd84b1735a69a0b771c73b70b9)

As I set the DAT is somehow corrupt. You should simply create new (propperly moded ) Desc from original SC4Model.
Title: Casting shadows on props
Post by: Andreas on April 18, 2009, 12:54:40 PM
I'll check that again. I got the models and prop exemplar files from voltaic, not sure if something went wrong during the modding process.
Title: Casting shadows on props
Post by: Andreas on April 20, 2009, 05:25:24 AM
@SimFox: I had some time to investigate the shadow issue - and I can only reiterate what I observed earlier: The game won't cast any shadows on props, regardless if the "Is Ground Model" property is set to "True" or "False". Take a look at the following pic:

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg218.imageshack.us%2Fimg218%2F843%2Fsc4shadows.th.jpg&hash=5fe4ddab50cb3a14d81d841f292774d6b18ea143) (http://img218.imageshack.us/my.php?image=sc4shadows.jpg)

I removed voltaic's DAT with the merged props and added the original files back into my plugins folder. The S3D files show up fine in the Reader, so I assume everyting is ok with the models. Then I set the "Is Ground Model" property of the roundabout in the middle (the greener one) to "false", and the one on the right to "true". I also plopped a Maxis basketball field lot as a reference. As you can see, the basketball field prop with the basket doesn't cast any shadows, so the "Is Ground Model" property of that one was set to "false", while the streetlight prop clearly casts a shadow - but not on the basketball field prop!

Could you try the same on your system? Maybe my graphics card (Matrox P650) isn't capable of rendering shadows properly? Or maybe your props work different, due to the fact that they were created in 3DStudioMax, rather than in gmax, like voltaic's roundabout filler? I would assume that Maxis also used 3DStudioMax, but maybe with a different setup.
Title: Casting shadows on props
Post by: SimFox on April 20, 2009, 06:38:28 AM
and I would have to reiterate that this shouldn#t be a problem...

here you see one prop (tree) casting shadow on another prop (roundabout circle)

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fs47.radikal.ru%2Fi116%2F0904%2F4f%2Ff1288e845242.jpg&hash=0c2ce59a8a7092f1a35e7b572a822964c1ae7adc)

and here both prop (tree) and nearby building both cast the shadow on a prop (roundabout circle)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fs57.radikal.ru%2Fi156%2F0904%2Fec%2F3fe2f5d5aabb.jpg&hash=b8b39d91d1bc21dd84b1735a69a0b771c73b70b9)

AS for particular prop I know that altering this property in DAT didn't work. That's why I asked your assistance...

I wonder what would be a reason for this not working in your case... Could you send me the original SC4Modle file for a roundabout circle so I could have a go at it?
Title: Casting shadows on props
Post by: Diggis on April 20, 2009, 07:55:34 AM
Hmmm, that is weird on the ground models.  One thought, is the model the building or the prop is both cases?  I would assume both are just props. 

Also maybe it's a setting with the Lot? 

And finally, what about the LOD height?  What height did you use SF?
Title: Casting shadows on props
Post by: Andreas on April 20, 2009, 08:35:50 AM
@Jan: Thanks for the hint, I'll keep that in mind when someone else is asking.

@SimFox: Well, my pic shows that even the Maxis props have the same behavior, and that's what I'm used to. The "shadow ability" must come from something else. I've attached the roundabout model files, so see for yourself, if you like.
Title: Casting shadows on props
Post by: SimFox on April 20, 2009, 12:43:46 PM
Ok I've made a little investigation and here are results...

Actually it was Diggis who had proposed the correct hypothesis about the condition to be met in order for a prop to receive the shadow.
It actually is a height of the LOD. And the critical number appears to be 0.3 meters. Also this appears to be only and enough condition, meaning that IsGroundModel doesn't need to be set to false. Even if true  model will still receive shadow (at least in case of the prop, haven't tested building).

My Roundabouts use 0.25m tall LODs so, naturally they were receiving Shadows and Voltairen's ones had 1.69 m tall LODs and that's the reason they didn't. Ground model or not.

here is what happens when I mover vertecies in Reader to 0.3m:

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fs40.radikal.ru%2Fi090%2F0904%2F8d%2F8de56842baac.jpg&hash=a1e84cf32828ffa705654af19349f70ee926e21f)

So, if these are to be fixed they would have to be re-exported. Luckily LODs on these could safely be lowered to under 0.3m with no consequence to the model.
Title: Casting shadows on props
Post by: Andreas on April 20, 2009, 01:38:03 PM
Interesting find! I'll discuss the issue with voltaic, maybe he can update his models accordingly. Unfortunately, he's dealing with some RL issues at the moment, so it might take a while.
Title: Casting shadows on props
Post by: SimFox on April 20, 2009, 02:03:08 PM
yep... it wouldn't need any alteration apart form LODs
Title: Casting shadows on props
Post by: Diggis on April 21, 2009, 12:56:20 AM
The reason I queried it was because is ground model sets whether the model cast's shadows.  I have to set it to false for my stream models as it's underground and you get weird shadows.  Good to know it's the height (I was just testing that now myself).

I've had a quick test and will do some more but it appears this is soley LOD based, and is not affected by the height of prop exemplar.  I will test this further tonight, but it's a good find.
Title: Casting shadows on props
Post by: SimFox on April 21, 2009, 03:40:46 AM
I can confirm that.
Sorry i wasn't quite thorough enough in my previous messages.
I've tested the numbers in Exemplars and they bare no influence on this phenomenon what so ever. It is all due to the hight of the LOD.
Title: Casting shadows on props
Post by: Diggis on April 21, 2009, 06:57:37 AM
Did you try with complex LODs?  I am guessing that if the LOD had a step in it that went up to say 1m then they shadow wouldn't show at that point, but would show on the rest of it, but it may just read the top vertex and say no shadows at all.
Title: Casting shadows on props
Post by: SimFox on April 21, 2009, 09:47:16 AM
1m step? Well, where could such a step be if as I've said the top hight of vertex along S3d's Y axis that still allow to receive full uninterrupted shadow is 0,3m increase this even a a couple of cm and you'll get a comb effect and at 0.4m  no shadow at all.
here is an illustration:
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fs55.radikal.ru%2Fi149%2F0904%2Fcd%2F27036294d45b.jpg&hash=26b65d1227a7194e1c0f08fbadc976a904f523e7)

in that model back top vertecies were risen to the hight of 1 m while front ones remain at default 9cm. You can see how shadow disappear through the "comb" stage as the 0.3 and 0.4m levels are breached 


PS
sorry for commandeering SFBT thread for this theoretical discussion...
Title: Re: Casting shadows on props
Post by: Diggis on April 21, 2009, 09:54:22 AM
Thats cool, pretty much what I expected.
Title: Re: Casting shadows on props
Post by: Andreas on April 21, 2009, 09:58:06 AM
I split the postings from the SFBT topic and moved them here, where it's more appropriate. :)
Title: Re: Casting shadows on props
Post by: Diggis on May 05, 2009, 01:01:25 AM
Have found one problem with this, it doesn't work for partially transparent props (ie, with a gradient Alpha).  When you change the settings you get the shadow showing up, but it ignores the model and shows the ground below.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi302.photobucket.com%2Falbums%2Fnn110%2FDiggis%2FBAT%2FNewCity-Jan12001241510191.jpg&hash=7c993df987813489a5f9a1adb76414e6a133e270)

I've tracked it down with early tests to the check box for framebuffer blending, although I need to check this.  Without the box ticked you get normal shadows but no transparency. This was with all the other settings as per normal for gradient transparency.  I need to check if ticking the box with settings normal will have the same effect.
Title: Re: Casting shadows on props
Post by: SimFox on May 05, 2009, 03:13:44 AM
I'm left a bit confused by this presentation...
Quote
When you change the settings you get the shadow showing up, but it ignores the model and shows the ground below.

what settings do you mean? the ones that enable the transparency blending?
What exactly "ignores model" means...  you say it shows the ground below, but isn't it where the model should become transparent? Or what should it show there then?
Title: Re: Casting shadows on props
Post by: Diggis on May 05, 2009, 06:13:36 AM
Yeah, if you look at your images you will see the shape and lines of the model under the shadow.  However in my picture you can see the pattern of the grass under the whole model, including the area where the visible portion of the model should be.  There should be a line in the shadow where the model ends.

And yes, the settings I mean are the transparency blending ones.  I worked through each change one by one and it wasn't untill I checked the framebuffer box that the problem occured (which unfortunatly is also the point the blending works) I need to check if ticking the box without the other settings will trigger it, as there might be another combination that provides the right results.
Title: Re: Casting shadows on props
Post by: SimFox on May 05, 2009, 12:28:21 PM
Oh, yeah!! I see it now...

How did I miss it?!?!


anywho, I see the problem now. But luckily it is a really minor one. I don't see really much use of transparent flat low models...
BTW is that model a building or prop, is there any difference?
Title: Re: Casting shadows on props
Post by: Diggis on May 07, 2009, 01:55:12 PM
That model was a prop, and I have some stream banks that use transparency blending to create a nice edge which would be nice with shadows.  Which is how I found the problem.  :'(

http://sc4devotion.com/forums/index.php?topic=5068.msg240291#msg240291
Title: Re: Casting shadows on props
Post by: SimFox on May 08, 2009, 03:57:44 AM
Oh, I see... that's really suck! It would have bee really neat application...
Title: Re: Casting shadows on props
Post by: Diggis on May 08, 2009, 04:33:46 AM
Yeah, still going to push on with the models regardless, but will look into the transparency setting and see if there is anything that can fix it.
Title: Re: Casting shadows on props
Post by: SimFox on May 08, 2009, 02:17:08 PM
I'll try my best. I really think it is a very worth cause...
I'm very busy at the moment but will be freer in a week or so...
btw are you making it like Nam puzzle pieces?
Title: Re: Casting shadows on props
Post by: Ennedi on May 08, 2009, 06:44:18 PM
Shaun, I think your problem is a part of a larger theme:
- How does the game work with layers ie. how does it cover one texture by another - especially if one or both textures are alpha-blended?

1. You have a problem with shadows on the semitransparent prop. But such props are used in SC4. These are various kinds of Transparent Ploppable Water.
I tested JRJ TPW, Chrisadams TPW and the new David's (Dedgren) Ploppable Water large lots. I was curious how shadows look on these lots - nobody announce any problem with them till now.

Jeronij's TPW:
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F9379%2Fbshadows1.jpg&hash=cc71dafbd8c96c015358ac19558cfdf1a75bffb7)

Chrisadams' TPW (shadows are less visible because of the water texture, but they work well in this case too):
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F3888%2Fbshadows2.jpg&hash=c96be502edfa95c79db1c0210b38996b9ffb8ab2)

And David's TPW
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F5382%2Fbshadows3.jpg&hash=ebb2ab8457a9e91ff3819e78ae4abf8154b9f599)

All these lots have one feature which is similar for all TPW lots but different from your lot: this is the model height.
- All TPW models are from 2 to 4 meters high. (That's an interesting information, especially when we compare it with the critical height of the "normal" ie. opaque model described earlier in this thread, which is equal to 0,3 m  :))
- Your model is 0,0 m high.

I'm rather sure that the height is the critical factor here. Why?
When Jeronij created his TPW, I tried to create a smooth transition between the ploppable and game water. I knew that it is quite easy with an old opaque ploppable water, because it can be placed at the sea bottom and it is covered by water depending on it's transparency at various depths. So we can make a smooth trasition simply placing the ploppable water at the sea bottom.

But when I tried to do the same with the new TPW, I found a strange thing: The Transparent Ploppable Water is visible when we plop it on the sea bottom only if the sea depth is less the the TPW model height.

Jeronij's TPW is 4 meters high (deep?  :)). Here the sea is 0,7 m deep (look at the y value in the Terrain Query, the sea level is 250,0 m and here we have 249,3 m)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F2615%2Fimg1266imp.jpg&hash=04af65f342d1d581e0ed878710adfb26a14e76e4)

Here the sea is 4 meters deep (exactly the same as the TPW height - lots are still visible)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F7802%2Fimg1267imp.jpg&hash=5a08a97cab7b2eda4d94ff728da87bfbac1e677f)

On the third picture the sea is only a bit (0,1 m) deeper. TPW lots are present here (as the query shows), but they are invisible.
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F8899%2Fimg1270imp.jpg&hash=9f0d75350e0f3d3b6a5a8166b68f7fb1c2d43c26)

So I wasn't able to make a transition between the TPW and the sea water. I hhad the same idea a Shaun ie. I tried to experiment with transparency. My way of thinking was:
- Maybe the TPW is invisible because its minimum alpha value is higher than alpha value for TPW?
So I decreased the minimum alpha valu for ingame water to 0. But it didn't make the TPW visible.

You can say that my experiments with the TPW and water are a different story. But I think both Shaun's and my problems have something common - both are connected with the model height, and the model height is connected with covering layers one by another. Its not a theory, it's rather guessing.

What would I suggest?
- Make your model more than 0,3 m high and see what will happen. If you will still have a problem, make it 2 m high (we know that TPW works well with shadows at that height, maybe there is another critical value?)

PS. After writing it I remembered something: some time ago MAS71 tried to make a canal/sea transition for his JRP canal lots. He made 1x4 overhanging lots with an alpha gradient. The model height was 0, exactly as in Shaun's lot. I decided to check shadows on this lot. And here is the result  :D

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg18.imageshack.us%2Fimg18%2F8489%2Fbshadows4.jpg&hash=056f008581c869afe3e24963bd3fc89fa4562bc7)

These lots were dedicated to place under water, so shadows weren't important for our Japanese friend. I suppose he even didn't check it.
But I think this experiment confirms my hypothesis, or at least makes it a bit more probable  :)

Adam

Edit: If my hypothesis is right, it can lead us to another interesting theme: we can check what will happen if we decrease the TPW model height below 0,3 m? Maybe it will become visible under water at the bigger depth too? It would solve the TPW/sea transition problem!  :)
Title: Re: Casting shadows on props
Post by: SimFox on May 09, 2009, 01:05:48 AM
Ennedi, I'm sorry I can't quite follow your deductions all the way...
I'm also not familiar with all the intricacies of the TPW design. But as far as hight of the LODs concerned I have some thoughts.

First of all it's important to make a distinction between the Model and LOD. Well, this is important to me as I always start thinking as a modeler not a moder.
Model is the actual meaningful geometry in the modeling software  be it GMAX or MAX. LOD is, well LOD. And, yes, I dop know that it serves as a model inside of game. But this dichotomy opens some interesting possibilities - model in some cases may be much taller than actual LOD. It doesn't always need to be contained withing it in all 3 axi. Enough conditions is taht it fully projects on teh LOD shell from the camera point of view. Saying that it is importatnto remember that view angle of different cameras is different and preview should be made for all of them.

Anyway, to the matter at hand. As much as I grasp it the issue with TPW isn't quite the same as with the, say, roundabout fillers or Shaun's work. You see, incase of TPW there isn't really any shadow ON it. What you see is a shadow of the object on the ground UNDER the water. So effectivelly you don't see shadow ON the water but you see it THROUGH the water.
Taking this fact into account you see that this isn't really a matter of LOD shell hight. Well with one important exception  when the Shell hight is 0 many weird things may happen. Since the game is in fact 3d environment, albeit a very primitive one situation known as Coplanarism (existence of coplanar elements) arise. Two separate element occupy exactly same spot leaving 3d engine wondering which one should be displayed. In this case the question is NOT of how to blend them. All blending method assume that something is over or under. To sort of safeguard against this event engine may have some sort of rule which ONE to display. what those rules may be in case of SC4 still needs to be looked into.

I believe to solve this problem we have to look at how transparency is used in game. From the top of my head I can think of two applications - shadows and game water. Looking at how each is functioning can provide a clue.


Title: Re: Casting shadows on props
Post by: Ennedi on May 09, 2009, 01:21:44 AM
Simfox,
I'm not a modeler but all your explanation sounds logical and even obvious in the main points.

Quote from: SimFox on May 09, 2009, 01:05:48 AM
(...)
Anyway, to the matter at hand. As much as I grasp it the issue with TPW isn't quite the same as with the, say, roundabout fillers or Shaun's work. You see, incase of TPW there isn't really any shadow ON it. What you see is a shadow of the object on the ground UNDER the water. So effectivelly you don't see shadow ON the water but you see it THROUGH the water.
(...)

I think exactly the same. But in this case increasing the model height looks like a good advice, isn't it?  ;)
Looking at your arguments I think it would be good to check both cases ie. the model height above and below 0,3 m (but not 0). Results could give us an additional information.

Quote from: SimFox on May 09, 2009, 01:05:48 AM
(...)
I believe to solve this problem we have to look at how transparency is used in game. From the top of my head I can think of two applications - shadows and game water. Looking at how each is functioning can provide a clue.
(...)

Very good, but what should we do to research the transparency? Which experiments could be made?

Adam
Title: Re: Casting shadows on props
Post by: jeronij on May 10, 2009, 02:03:13 AM
Quote from: Diggis on May 08, 2009, 04:33:46 AM
Yeah, still going to push on with the models regardless, but will look into the transparency setting and see if there is anything that can fix it.

Regarding Shaun's issue, I hope this may help somehow : http://sc4devotion.com/forums/index.php?topic=7813.msg244976#msg244976

;)

Regarding the way the game handles transparency, I think this is a very interesting discussion, because I worked "blinded" somehow when I made the TPW, and I went to the final result using the old try and fail empirical method, so much time consuming....  ::) ... the more knowledge we can have about the game's mechanics, the best for all  :thumbsup:
Title: Re: Casting shadows on props
Post by: Diggis on May 10, 2009, 04:13:04 AM
Adam,  I've had a quick read through your comments and will read them more in depth when I get a chance.  The thing that stands out is that the TPW is a constant opacity, where as my model has a gradient opacity.  Idealy I would like the shadow to show on the model where it is solid, and the ground where it shows through.  A little much to ask possibly :(

JrJ, thanks for the link, I'll take a look at that when I can.