TUTORIAL Top shadows for trees

Discussion in 'Tracks' started by luchian, Jul 26, 2017.

  1. luchian

    luchian Administrator Staff Member

    Joined:
    Jun 3, 2014
    Messages:
    3,007
    Likes Received:
    1,491
    Again, one great tip from @LilSKi . This time we are working on tree shadows, which, especially around noon when the sun is basically above, look really bad. You get sort of a Y shadow that kinda breaks the immersion. Looking like this:
    1.png

    Luckily, we now have a solution to correct this unfortunate situation :D. I remember I have also seen this in the original Hope track by lemax, when I did the conversion, but did not use it at that time, thinking "if Kunos didn't do it, there must be a reason". Wrong. As it turns out, Kunos DOES use it also nowadays. Who knows, maybe after inspiration from the forums.

    Anyways, back to our problem, here are the steps as layed down by Lilski (so from here, whenever you read "I", it's "I, Lilski", not "I, Luchian" :D). Credit goes out to @bzucobzuco as well, as he was the one that originally came up with the concept in the luccaring thread.

    So the first tip is horizontal planes for the trees so they have shadows around 12 noon. You may be thinking well that sucks I already did my trees I don't want to have to redo them. the cool thing is you don't have to and I'm going to show you how.

    NOTE: I work in blender so all my tips will be on that platform.

    You have seen already the "bad" tree at 12 noon, above.

    This is with the horizontal plane in place. Now in my case I just used a single shadow texture for all of them since none of my trees are real close to the track. But if yours are right on the road edge you may want to use 4 or so different shadow textures so they don't all look the same like these do.
    2.png

    So here is how you do it.

    First off on my trees I have my pivot points all on the bottom of the object. if you didn't do this that is fine. but in the future I suggest you do that as it makes it much easier to apply a random scale to you trees so they all aren't the same size.

    So the first step is you need to make a texture. It is basically the same as a normal tree texture except you set the opacity of the main layer to 1%. You will need PS for this as the DDS exporter for gimp does not seem to make the texture properly

    This is what it looks like at 100%. Just set the opacity to 1% and then export to DDS DXT5. Attached below is the actual working DDS found on my track and shown above. You may use it as you wish.
    3.png

    So now that you have the texture you must make the plane and then get that plane to be in place on each existing tree. What you do is select all the trees you want to have this shadow and then duplicate them BUT DON'T MOVE THEM. Just duplicate them in place and hit the M key and select an empty layer in your blender file. Now you have the trees duplicated and sent over to a separate layer from your main trees.

    In the new layer duplicate a single tree and move it away from the rest and single it out. Also make sure it is perfectly vertical and not tilted in any way.
    4.png

    Next create a plane and position it over the tree you singled out. Now would be a good time to map your texture to it. The plane can be single sided but the texture MUST FACE DOWN.
    5.png

    Now you want to join the plane to the tree object
    6.png

    Once joined go into edit mode and delete all the parts of the original tree.
    7.png


    Now you have a plane with the correct pivot point of the original tree.
    8.png

    Now comes the simple part. Select all your trees but make sure the plane is active
    9.png

    Hit CTRL+L and choose "Object Data" and you will get this.
    10.png

    Now your plane is in place of the original trees with the correct scale and angle of the original tree.

    Next part, the shader settings in SDK Editor.
    11.png

    You can't see the settings above. The only thing that matters is the ksalpharef. The rest don't make any difference. A "zoom":
    12.png


    You can play with the numbers a bit to make the shadow thicker or thinner.

    And on another note I also did a similar process for the tree line. I made a long texture texture out of the same texture used on the individual trees.
    13.png

    This way inside the first tree row it is shaded.
    14.png

    So it doesn't look like this:
    15.png

    Below is a zip with both the single and tree line textures. Again you are free to use them as you wish.
    I hope this made sense and helps somebody!

    So there you go. If you were looking at Lilski's tracks and were wondering "how the..", now you know his secrets. Have fun :).
     

    Attached Files:

    Rob Pawn, quetillo and Johnr777 like this.
  2. LilSKi

    LilSKi Well-Known Member

    Joined:
    Apr 6, 2015
    Messages:
    370
    Likes Received:
    329
    I would like to clarify that this is really only needed when the trees like shown above don't 'touch the ground'. When I did NJMP and now Bridgehampton 2.0 I made a tree texture where the leaves touch the ground. This hides the trunk area better and there is little need for the horizontal plane.

    Here is NJMP

    Screenshot_bmw_z4_gt3_njmp_lightning_11-2-117-14-55-31.jpg
    Here is Bridgehampton. Here I also used a 'bush' object at the base of the trees to get the overgrown look.
    Screenshot_bmw_z4_gt3_bridgehampton_18-6-117-1-30-36.jpg
     
  3. luchian

    luchian Administrator Staff Member

    Joined:
    Jun 3, 2014
    Messages:
    3,007
    Likes Received:
    1,491
    Wow, this last picture looks almost like a photo ! :eek:
    I should be finally home somewhere Saturday, I will make it a point in observing all your tracks @LilSKi :nerd:.

    Anyway, thanks for the clarification. This is why I prefer topics separated so we can discuss or.. ask for help :D
     
  4. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    For my Fuji 93 track I created years ago, I ended up using "vertex painting" in 3ds max to paint static shadows under the trees since the game didnt cast shadows correctly. But this was gMotor... Don't know if that would work in AC, worth a try :)

    Not bad for an 8 year old track huh

    fuji007.jpg
     
    quetillo, JrC and luchian like this.
  5. LilSKi

    LilSKi Well-Known Member

    Joined:
    Apr 6, 2015
    Messages:
    370
    Likes Received:
    329
    I use the horizontal plane method in blender to create an AO map that I add to my mask textures for the terrain. Given that the real time shadows only draw so far you need the AO shadow to be there so at a distance it looks correct.
     
    jonelsorel and luchian like this.
  6. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    89
    Likes Received:
    17
    Location:
    Germany
    Great Solution! Especially the hint for generating it in blender! So time saving!!! THX a lot!

    Should the "TopShadow" Plane called as well with ksTreeGroup or doesn't matter?
    (iam not sure if the object name will animate the tree moving or the ksTree shader)
     
  7. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    It shouldnt.

    Since they are all simple 1 quad meshes, merge them all into one object.

    Any tree movement is dependent on ksTree shader, which this mesh wouldnt use
     
  8. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    89
    Likes Received:
    17
    Location:
    Germany
    alright, moving through the shader. nice!

    wouldn't it be better the shadow is moving with the tree?
    LilSKy is using kstree shader i see in the pictures above.
     
  9. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    Then you can try and see. But dont expect a flat horizontal plane to react to wind too much
     
    Rob Pawn likes this.
  10. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    89
    Likes Received:
    17
    Location:
    Germany
    to prevent that we could place a transparent plane vertically.
    or even just merge the topshadow plane to the tree. I will see...
     
  11. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    I wouldnt do the second thing, might mess up the auto-normals created when using kstreegroup
     
    Rob Pawn likes this.
  12. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    89
    Likes Received:
    17
    Location:
    Germany
    agree, after merge it together - TopShadow Texture (Material) got killed and do not show up in ksEditor...
    Tree is still moving normal. Maybe there is a way around it... dunno yet...
     
  13. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    What did you merge? shadow caster object to trees?
     
  14. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    89
    Likes Received:
    17
    Location:
    Germany
    Yes, the topShadow Plane to the Y-Tree.

    hold on - merge is maybe the wrong word. i joined it (in Blender)
     
  15. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,048
    Likes Received:
    613
    as per my suggestion above, not a good idea to do that.
     
    Rob Pawn likes this.
  16. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    89
    Likes Received:
    17
    Location:
    Germany
    OK. fine so far. For example i have a tree alley with only 5 different trees. To get more variation into the shadows on the road i use several different "TopShadow" textures. Additional i spin and readjust a couple of the TopShadowPlanes. With the "Object Data Link" we run into a little Problem - in Edit Mode in blender we adjust every linked mesh - with this Method its not possible to adjust a single mesh in edit Mode without make changes on every linked object - they all act like the one you wanna edit (even if you do not selected them - until you unlink them again:

    select which ones you wanne edit seperatly (on its own) or just all and then do this:
    [​IMG]
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice