• Dear visitors,

    The email issue seems to have been finally solved.
    Thank you for your patience and happy browsing.

    Team ACM.

SHADER setting-up trees

jarodyi

New Member
If by wire you mean this, you can also do it using ksPerPixelAT (or ksPerPixelAT_NM if you have a normal map).

View attachment 340
1 and can u share u wire.dds and 3ds file in pic with me?

2 can u show me your trees setting in aceditor? i can`t get trees view right :(

3 can u tell me how does the "Illumination" works for ? just see the time effect in editor but not set the sun position in game?

thanks:)
 

Attachments

luchian

Administrator
Staff member
2/ Best way (recommended by Kunos) is to use Y trees (remember, AC does not support double sided materials, so you must mirror faces). You can have a look at the trees in the sample track provided with the game STEAM\steamapps\common\assettocorsa\sdk\editor\samples\newbury.

2014-11-04_223532.png


You can setup normals manually, but there is an easier way, if you respect 2 conditions. This will assure best look and best performance for your trees.

1) respect naming convention: KSTREE_GROUP_”anyname“_”number”
Example: KSTREE_GROUP_test_1. A group will be formed by all the objects that have the same name and continuous numbering: KSTREE_GROUP_test_2, KSTREE_GROUP_test_3, KSTREE_GROUP_test_4, and so on. If you wish a second group, change the name of the group: KSTREE_GROUP_other_1, 2, 3, ...

2) the pivot point of the single tree must be in the center of the geometry (or slightly moved on Z axis). This way, the ksEditor will set the normals automatically when you import your FBX.​
 
Last edited:

luchian

Administrator
Staff member
This is a study made by our fellow forumer @LilSKi << all credits
Setting up correctly the trees in AC, not only helps you and make your life easier, but also improves the lighting and the performance. Therefore, it's highly recommended that you give this a read and try to follow it :).

/by Lilski
Basic overview of trees in AC. There is some confusion out there as to the right and wrong way to setup trees for AC. Below are some examples of different trees and what they look like in the editor/sim.

Here they are in blender. I did 4 basic types of trees and shown in red are the object names. Two of them use the KSTREE naming scheme and two do not. The TREE on the far left has all normals set to vertical. The rest the normals are untouched from default. Also notice the vertical subdivisions.
1.JPG

Here they are in the editor with sun overhead. You can see we now have 4 very different trees. the far left with vertical normals is fully lit with no shading at all. Next to that we see that using the KSTREE object name has altered the normals automatically. The issue here is the entire center of the tree is dark and only the edges are lit up. Next to that in group B you can see the desired result. The only difference between A and B is the extra vertical subdivision shown above. Then TREE2 is just a disaster.
2.JPG

Here they are at low light. As you can see TREE is still lit from top to bottom and completely unnatural. I believe this is what most RTB trees are doing. Group A doesn't look bad but again too dark in the center. Group B again is the desired result. TREE2 still a disaster. All 4 trees here are using the same shader settings.
3.JPG

One important thing about the tree objects is in order for the KSTREE auto normals to work properly the origin of the object MUST be at the bottom.
4.JPG

Now lets discuss the whole GROUP thing. It is worth mentioning that from within blender or 3DS you MUST keep the tree objects separate. DO NOT join them together. The KSTREE naming scheme does that for you with the groups.

So here is a shot of Bridgehampton trees in blender. Selected below is GROUP_A. Notice each tree is a separate object.
5-groupA.JPG

Just to show here is GROUP_B. This trend goes around the whole track with GROUP_C. GROUP_D, etc.
6-groupB.JPG

You do not have to use A, B, C, D, etc. You can use anything like KSTREE_GROUP_PINE_, KSTREE_GROUP_MAPLE, etc. I find the letters the easiest.

This is what it will look like after you load it in the editor. there will be a section called "BLOCKTRANSFORM" and you will find the group names in there. The KSTREE_GROUP part of the name will be stripped away.
7.jpg

I hope this clears up some confusion. Also know that just because you use the KSTREE_GROUP_x_ naming scheme DOES NOT mean you have to use the kstree shader. The entire point of the KSTREE naming is to auto set the normals for you and join to single objects according to group name. You can also use KSTREE naming on 3D trees and it will set the normals just like a Y tree. Just make sure the origin is always at the bottom and the normals will all be done for you on import to the editor.

Some final examples of trees in sim. Notice how the bottoms are all dark as they should be.
8.jpg

9.jpg



Because you've made it this far, HERE is a bonus :).
 
Last edited:

Pixelchaser

Well-Known Member
be nice to see all lilski`s tutorials here. I should be looking at the grass tuts but I'm so damned lazy. :lol: was it nighteye who did the grass?
 
Last edited:

Pixelchaser

Well-Known Member
generally you balance that with your complete main scenery. altogether its hovering around 0.2 to 0.3 for these figures when the rest is balanced.
 

LilSKi

Well-Known Member
Taken from persistence file from NJMP which is shown above. But obviously a lot depends on your textures and how bright they are and as what Pixelchaser said regarding your surrounding scenery.

[MATERIAL_5]
NAME=TREE1__tree1_dds
SHADER=ksTree
ALPHABLEND=0
ALPHATEST=1
DEPTHMODE=0
VARCOUNT=6
VAR_0_NAME=ksAmbient
VAR_0_FLOAT1=0.4
VAR_0_FLOAT2=0,0
VAR_0_FLOAT3=0,0,0
VAR_0_FLOAT4=0,0,0,0
VAR_1_NAME=ksDiffuse
VAR_1_FLOAT1=0.25
VAR_1_FLOAT2=0,0
VAR_1_FLOAT3=0,0,0
VAR_1_FLOAT4=0,0,0,0
VAR_2_NAME=ksSpecular
VAR_2_FLOAT1=0
VAR_2_FLOAT2=0,0
VAR_2_FLOAT3=0,0,0
VAR_2_FLOAT4=0,0,0,0
VAR_3_NAME=ksSpecularEXP
VAR_3_FLOAT1=1
VAR_3_FLOAT2=0,0
VAR_3_FLOAT3=0,0,0
VAR_3_FLOAT4=0,0,0,0
VAR_4_NAME=ksEmissive
VAR_4_FLOAT1=0
VAR_4_FLOAT2=0,0
VAR_4_FLOAT3=0,0,0
VAR_4_FLOAT4=0,0,0,0
VAR_5_NAME=ksAlphaRef
VAR_5_FLOAT1=0.5
VAR_5_FLOAT2=0,0
VAR_5_FLOAT3=0,0,0
VAR_5_FLOAT4=0,0,0,0
RESCOUNT=1
RES_0_NAME=txDiffuse
RES_0_SLOT=0
RES_0_TEXTURE=tree1.dds
 
Last edited:

Pixelchaser

Well-Known Member
its also good to be on the darkside if you cant decide, as trees generally are, well as opposed to ground grass. but it can be close..... what will make it Sweet is when you get the shadowing or ambient occlusion working well on it ala Lilski tutorial.
 

Mitja Bonca

Active Member
I did not name tree lines with KSTREE_GROUP_SOMENAME_NUMBER, but only 3d trees.
So here is the result in ksEditor:


You can see that tree lines have fine lighting. 3d trees has a reversed lighting. What could be wrong?
 

Mitja Bonca

Active Member
From the game:
Toward sun (bright 3d trees, and dark tree wall):


Away from the sun (dark 3d trees, and bright wall tree):
 

LilSKi

Well-Known Member
You can argue with me all you want. The fix is setting the tree wall normals to full vertical. If you want to beat your head against the wall trying to fix it another way be my guest.

And the 3D Y trees are too bright.
 

Mitja Bonca

Active Member
Hehe, ok. I will take a look into tree wall. It was not logical to me, but I will surely listen to you. Will keep you posted about it.
 

Mitja Bonca

Active Member
Can I ask you one more thing? I have one texture for 3d trees and tree wall. Is it not possible to set different shaders for both? Do I have to separate textures?
 

LilSKi

Well-Known Member
Just make a new material for the walls in 3Ds. Two different materials can use the same texture in the editor. But in general I have the tree walls as its own texture separate from the 3D tree textures. But making a new material for the tree wall will accomplish the same thing.
 
Top