Jump to content

[Source] What am I doing wrong with my tree?


Recommended Posts

Posted (edited)

Here's a shot of my WIP tree:

treeshadow.jpg

From the left:

Shadows ON and ignore surface normals OFF
Shadows ON and ignore surface normals ON
Shadows OFF and ignore surface normals OFF

I've edited my surface normals (radial in blender), so the tree on the left is looking more realistic in terms of lighting. However as you can see, the shadows are just too thick. The tree trunk is literally black. The same shadow problem is happening on the ground, where it looks to be casting double shadows?! One that outlines the transparent branches/leaves and one large blurry mess that follows the edges. If I disable shadows, the blurry messy shadow disappears (see tree on the right), but that also makes the tree look flat. The interesting thing is Valve's trees are NOT doing this despite shadows turned ON.

I've tried making sure I do exactly as Valve, but I'm obviously missing something critical. Here are the steps I've taken:

  • Make sure my VMT use exactly the same parameters as Valve
    •     $alphatest "1"
          $alphatestreference "0.3"
          $nocull "1"
      (and some tree sway)
  • Make sure my prop_statics have exactly the same settings
  • Make sure I have forcetextureshadows on my model in my custom .rad (and that the path is correct)
  • Check the console so that the .rad file gets read (it does)

Any pointers? Is it the surface normals that are wrong?

EDIT: Ok I managed to reduce the shadows on the actual tree by reducing the normal editing mix effect, however the blurry ground shadow remains a problem.

Edited by grapen
Posted

I don't have an answer but I am interested in the solution. A map I am working on has many trees and plants and I can't seem to figure out the best model settings. What're the best practices?

Do I disable per-vertex lighting? Disable self-shadowing? Both?

Posted
4 hours ago, Yanzl said:

Make sure you compile with -textureshadows and add your model to lights.rad with forcetextureshadow.

Yep done that to no effect :(

6 hours ago, wylde said:

I don't have an answer but I am interested in the solution. A map I am working on has many trees and plants and I can't seem to figure out the best model settings. What're the best practices?

Do I disable per-vertex lighting? Disable self-shadowing? Both?

Valve foliage typically requires "Ignore Surface Normals" set to YES since they don't have custom normals on the model itself. The rest of the settings can be default for the most part.

Posted (edited)

In my test map I have my tree and Valve's urban tree. In the console shot below we can see that Valve's alpha is being loaded, but not mine?

logfile.jpg

My .rad command is:

forcetextureshadow de_scepter\scep_tree01.mdl

:???:

I might also add that the other lines in scepter.rad is being read and working as intended, it's just this line that doesn't seem to work. I've also tried backslash instead of slash for the path but that didn't matter at all.

Edited by grapen
Posted (edited)
44 minutes ago, Yanzl said:

What's your tree model path, vmt path and vtf path? Seems like everything should be working, so there's either a typo somewhere or something very weird going on.

Dirs:

...\csgo\models\de_scepter\scep_tree01.mdl
...\csgo\materials\models\de_scepter\scep_tree01branch.vtf
...\csgo\materials\models\de_scepter\scep_tree01branch.vmt

.rad file:

forcetextureshadow    de_scepter\scep_tree01.mdl
de_scepter\scep_windowglass01b    252 239 209 100
de_scepter\scep_windowglass01c    143 183 230 100
noshadow    models\de_scepter\scep_grate01

Line 2, 3 and 4 are working just fine. So the rad file is being read, but the compiler refuse to ray-trace the alpha. The vtf is 1024, DXT5, eight bit alpha, so no funny stuff there I don't think?

I found this thread with the same problem, but it didn't lead anywhere: https://tf2maps.net/threads/textureshadows-not-reading-my-lights-rad-file-correctly.26297/

Another thread that lead nowhere: https://tf2maps.net/threads/problems-with-textureshadows.24736/

Checked the poly count to make sure it wouldn't be that, but my tree is cheaper than Valve's urban tree..

Made a new model featuring just ONE branch, problem persist, definitely not polycount related, but could still be model related. Or material. Either of those probably.

Edited by grapen
Posted

You can try moving the forcetextureshadow line to the end of the file or move it to the end of default lights.rad. 

Put just this in your vmt: 

VertexLitGeneric

{

$basetexture "models\de_scepter\scep_tree01branch"

 

$alphatest 1

$nocull 1

}

Posted

Issue has been resolved.

@Yanzl recompiled my model in Max/Maya(?) and got it to work. I had a look at his qc and found that he was using smd instead of dmx. I've been using dmx all this time thinking it was the newer, superior format. Tried to compile again using smd, still didn't work. Fak.

Had a look at my rad file again and changed the backslash to a slash in my material path. It worked. What the fuck. I'm using backslashes in all my materials and qc's and that is working fine. Not in rad files apparently.

So yeah, smd and slashes are required for forcetextureshadow. If any mod wants to rename the title of this thead to make it more Google-friendly, go ahead. I'd suggest [SOLVED] forcetextureshadow not working on custom prop, or something to that extent. None of the other results have an actual solution.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...