adding shadows

Tips and discussion about scenery creation for RailWorks.

adding shadows

Unread postby eyein12 » Thu Jun 23, 2011 5:03 pm

hey guys whats the shader for adding shadows to a structure. i would like the concrete beams of my underpass to display a shadow against the wall.

thanks as always!
Home of the NEW TIER 4 GEVO PACK, SD90/80mac PACK, BNSF SEATTLE SUBDIVISION ROUTE,UPDATES and more...

http://eyein12.blogspot.com/

https://www.youtube.com/channel/UCtWF-X ... dY7ag/feed
eyein12
 
Posts: 1258
Joined: Fri Oct 15, 2010 9:47 am
Location: Pottstown, PA USA

Re: adding shadows

Unread postby TVRRMAN » Thu Jun 23, 2011 5:14 pm

eyein12 wrote:hey guys whats the shader for adding shadows to a structure. i would like the concrete beams of my underpass to display a shadow against the wall.

thanks as always!


Eyein12, I depending on the shader being used, I believe its StencilShadow.fx, and you'll want the shadow model named specifically as shadowmodel or something along those whereabouts.I've had good results in 3D Canvas setting up my models as such with that naming sequence.

Hope this helps.
Thomas J Pearce
Image
http://www.bllw.net
Broadway Limited Locomotive Works Payware Department
TVRRMAN
 
Posts: 213
Joined: Sat Feb 28, 2009 8:06 pm
Location: Near Pittsburgh PA

Re: adding shadows

Unread postby GreatNortherner » Fri Jun 24, 2011 2:11 pm

Hi,

There's also the "outside shadow box" method, which Sly has discussed at UKTS a while ago: Have the shadow object OUTSIDE of the main object, so in other words, the shadow is larger than the main object. Invert the shadow object's faces (inside out) for best effect.

This is a much quicker way of getting a low detailed dynamic shadow to show up.

Here's the full story:
http://forums.uktrainsim.com/viewtopic. ... &sk=t&sd=a

Cheers,
Michael
User avatar
GreatNortherner
 
Posts: 1586
Joined: Sun Feb 15, 2009 11:19 am
Location: Czech Republic

Re: adding shadows

Unread postby eyein12 » Fri Jun 24, 2011 2:56 pm

michael,

as always thank you for your help, you've re-ignited my interest in this again. will give it a whirl on sunday!
That sounds alot easier.
cheers!

ian
Home of the NEW TIER 4 GEVO PACK, SD90/80mac PACK, BNSF SEATTLE SUBDIVISION ROUTE,UPDATES and more...

http://eyein12.blogspot.com/

https://www.youtube.com/channel/UCtWF-X ... dY7ag/feed
eyein12
 
Posts: 1258
Joined: Fri Oct 15, 2010 9:47 am
Location: Pottstown, PA USA

Re: adding shadows

Unread postby eyein12 » Mon Jun 27, 2011 2:01 pm

didnt turn out right. i just created a box around my model and added stencil shadow.fx and conventional naming is right too. but i just added a grey.ace texture to it and didnt work for me. whats the texture need to be if any?

thanks
Home of the NEW TIER 4 GEVO PACK, SD90/80mac PACK, BNSF SEATTLE SUBDIVISION ROUTE,UPDATES and more...

http://eyein12.blogspot.com/

https://www.youtube.com/channel/UCtWF-X ... dY7ag/feed
eyein12
 
Posts: 1258
Joined: Fri Oct 15, 2010 9:47 am
Location: Pottstown, PA USA

Re: adding shadows

Unread postby Kali » Mon Jun 27, 2011 3:04 pm

I don't think it matters, tbh, it's like the extra slots the other fx shaders have, it's just there to provide another texture pass.
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: adding shadows

Unread postby SMMDigital » Mon Jun 27, 2011 5:15 pm

Textures really don't matter for the shadow model - for all intents and purposes, you could simply duplicate the finished and painted model parts and make them a bit smaller, and then apply the StencilShadow.fx shader. However, to avoid confusion if I have to go back to work on the original model in the modeling program, I usually paint the shadow models a dark gray or black.

Shadows can be tricky. The parts of a shadow model itself MUST be "complete" - a whole cube, cylinder, or sphere. The more complicated, or the more faces, a shadow model has, the less likely it will work. If your shadow model is open, or is missing a face, or if its a flat two-sided plane, it will artifact, causing your shadows to become distorted, jagged, or throw in weird ways. I guess the whole point to shadow making is the old KISS method.

Another issue that i've found with shadows in 3DCrafter is that you must make sure that if you move your shadow model or repaint it, be sure to re-apply your Shader in the RailSim properties box. I can't tell you how many times i've moved a shadow object in the 3DC, saved the object, exported the IGS file, and then pulled it up in the Asset Editor to find that the shadow shader had disappeared.
SMMDigital
 

Re: adding shadows

Unread postby spec5sx » Mon Jun 27, 2011 7:12 pm

Here's a quick tutorial for everyone who needs to know how to make stencil shadows for their models. In order to stay brief, I will guide you through the steps of making a simple box shadow for a building.
This applies only to 3dsMax any version.

1. Create a new box shape in 3dsMax. Roughly the same size as your main model.
2. With your new box still selected right-click and select, Convert To -- Editable Poly. ( Special UV Mapping is not important for shadow objects. A standard box comes with a standard box UV Map.)
3. In the Modifier Tab, name your new box according to Railworks naming conventions. (this is a must!)

Image



4. Open the Material Editor.
5. Drag and drop a material copy into an empty sample slot.
6. Rename the material. (You can give it any name you want, but the name MUST begin with "shadow_" to be detected.)
7. Choose StencilShadow.fx from the Shader Name drop down list.
8. Click on the Slot Texture.

Image



9. Still in the Material Editor, (with your shadow model selected in the viewport) click, Assign Material To Selection.
10. Click, Show Standard Map In Viewport, to show/hide your texture.

Image



11. Close the Material Editor and open up Schematic View.
12. In Schematic View, click the Select and link button.
13. Select your shadow model and drag a link from it to your main model.



Image

Check to make sure all the faces of each of your model parts has a texture applied to it. Check that your all of the parts are properly named, and properly centered in the world view.
Then select all of your model parts and perform a Reset Transform and Reset Scale from the Hierarchy Tab.
Then export your model and cross your fingers. *!greengrin!*

This is how I do it in 3dsMax, but others may do it differently.

Hope this helps.
Last edited by spec5sx on Mon Jun 27, 2011 9:06 pm, edited 1 time in total.
The word?..The word is no. I am, therefore, going anyway..
User avatar
spec5sx
 
Posts: 213
Joined: Sat Mar 07, 2009 9:39 pm

Re: adding shadows

Unread postby Trainguy76 » Mon Jun 27, 2011 7:16 pm

I know in 3dCrafter, you must use a texture that is already used on the model.
User avatar
Trainguy76
 
Posts: 630
Joined: Mon Feb 15, 2010 12:46 am
Location: San Bernardino, California

Re: adding shadows

Unread postby Bananarama » Mon Jun 27, 2011 8:35 pm

Great tutorial, John! !!*ok*!!
Cheers!
Marc - 3DTrains

Image
User avatar
Bananarama
 
Posts: 2749
Joined: Sat Feb 14, 2009 1:17 am
Location: Another Planet

Re: adding shadows

Unread postby ricksan » Mon Jun 27, 2011 9:24 pm

You don't need to link the shadow volume to the main object. It/they can be in the base level of the hierarchy. Exception: A shadow volume associated with an animated part must be linked to that part.

Other considerations.

The edge of each triangle comprising a shadow volume must be contiguous with the edge of one and only one other triangle, sharing the vertices at the two ends of that edge. That's a technical way of saying the volume's surfaces must be a continuum throughout: No gaps, discontinuities, duplicate triangles or "dangling" triangles having one or more unattached edges. Any shadow volume that's not a continuum will cause shadow artifacts in the game, those linear things that extend out from your model, sometimes canceling the "true" shadow. If you're seeing these, you can narrow down the location of the offending exposed edge(s) by looking at the model from different angles and tracing the artifact lines back to their origin. I've found that certain actions, such as snapping vertices together without welding them, will create linear triangles that are hidden inside an edge.

You can have as many shadow volumes as you want and they can intersect each other -- as long as each separate one follows the "continuum" rule.

The shadow volume can be as complex as you want, as long as...OK, you got it.

The RW developer docs recommend that each non-co-planar surface be assigned a separate smoothing group. I always do that, because that's what it says to do. However, my understanding is that the shadow-volume algorithm looks only at the XYZ coordinates of the shadow volume's vertices to find the outermost edge of it from the point of view of the light source. So I don't know what the smoothing group, which relates to the vertex normals, has to do with anything. But then, I haven't tried to mess with it.
ricksan
Forum Mod
 
Posts: 327
Joined: Fri Feb 13, 2009 10:55 am
Location: Bandon, OR USA

Re: adding shadows

Unread postby arizonachris » Mon Jun 27, 2011 10:14 pm

I think this should be a sticky. Yes, nice work, john! !*salute*!
Ryzen 7 2700K, Asus Prime X570P, 32Gb DDR4, 2x 1Tb M.2 SSD's, RTX2060 6Gb, Occulus Rift
Win 10 Pro 64bit, keyboard/ mouse/ wheel/ pedals/ baseball bat
Security Coordinator on the Battleship Iowa
User avatar
arizonachris
 
Posts: 3956
Joined: Sun Mar 21, 2010 10:36 am
Location: Southern California

Re: adding shadows

Unread postby Hawk » Tue Jun 28, 2011 6:15 am

OK! It's stickyed. !*salute*!

Think it should go in the Scenery Design forum or stay here in the General Discussion forum?
Hawk
 

Re: adding shadows

Unread postby micaelcorleone » Tue Jun 28, 2011 6:55 am

Hawk wrote:Think it should go in the Scenery Design forum or stay here in the General Discussion forum?

Thought the same.
I think it's better located in Scenery Design.
User avatar
micaelcorleone
 
Posts: 1668
Joined: Tue Oct 05, 2010 11:04 am
Location: Bavaria, Germany

Re: adding shadows

Unread postby Hawk » Tue Jun 28, 2011 7:51 am

I think so too, so I moved it. *!greengrin!*
Hawk
 

Next

Return to Scenery Design

Who is online

Users browsing this forum: No registered users and 1 guest