Wanted, Shadow Assassin (A Request for Help)

To misquote Lady Macbeth - Out, damned shadows. Over the years I have used the same ASCII model, with minor edits, for most of my projects. Occasionally, I would notice a phenomenon when it was possible to see a darkening under the transparent areas of my placeables. When he still hung out around here, @TheBarbarian suggested that this was due to shadows being somehow enabled in my models. Since he’s no longer around I have come to the same conclusion. For those that don’t know what I am talking about here is the model and associated texture -

#MAXMODEL ASCII
# model: plc_trtribal23
filedependancy plc_trtribal23.max
newmodel plc_trtribal23
setsupermodel plc_trtribal23 NULL
classification character
setanimationscale 1
#MAXGEOM  ASCII
beginmodelgeom plc_trtribal23
node dummy plc_trtribal23
  parent NULL
  #part-number 0
endnode
node trimesh Plane01
  parent plc_trtribal23
  #part-number 1
  ambient 1 1 1
  diffuse 1 1 1
  specular 0 0 0
  shininess 1
  bitmap TRTrib_Symb23
  verts 4
    -5 5 0
    -5 -5 0
    5 5 0
    5 -5 0
  tverts 4
    0 1 0
    0 0 0
    1 1 0
    1 0 0
  faces 2
    0 1 2 1 0 1 2 1
    3 2 1 1 3 2 1 1
  position 0 0 0
  orientation 0 0 0 0
  scale 1
  selfillumcolor 0 0 0
  alpha 1
endnode
endmodelgeom plc_trtribal23

donemodel plc_trtribal23


(Note the transparent parts have been replaced with a grey checkerboard pattern in order to post here)

So my question is this - Is there something I can add to the model that will disable shadows? If so what? As most of my projects are either intended to be walked on or placed tight against walls, there has been no requirement for a pwk either as a separate file or internal to the model. So a model only solution is to be preferred.

Thanks for any help on this.

TR

There are so many issues with custom models that I just turn shadows off by setting Shadow Opacity to zero in area settings. Never missed them, either.

Not the answer you’re looking for, of course.

Yes… Out, damn shadows! I can concur with the great Will (and of course with the great TR on that :wink:

To deactivate shadows, you can try adding a “shadow 0” line (without quotes) in every trimesh node you want to process. Put it just after the parent line before the ambient 1 1 1.

Shadows are very annoying, so in 99% cases i deactivate all of the shadow from the parts in my models and make a big simplified/unified dummy shape that is the only shadowy model part with a “shadow 1”.

I don’t understand how shadows work in the fine print but am sure others with more technical understanding will explain more. Hope this helps,

CG

PS: Strangely, i just discovered that my models use the Shadow command with the S in Caps. It is strange because all the others model commands begin with a letter in Min. Could be the model engine does not care with Min/Majs.

Thanks CG, I’ll give that a try. If it works that does raise another problem though. Anyone know of a batch file that can insert a line of text immediately after a line containing certain other text (I’ll have literally hundreds of existing models to go through)? Something along the lines of this (It removes all the blank lines from all the files in a folder) that I found after much searching online -

@echo off
    setlocal enableextensions disabledelayedexpansion

    call :getBatchFileFullPath batch
    for %%a in ("%batch%") do set "folder=%%~dpa"
    set "tempFile=%folder%\~%random%%random%%random%"

    for %%a in ("%folder%\*") do if /i not "%%~fa"=="%batch%" (
        findstr /v /r /c:"^$" "%%~fa" > "%tempFile%"
        move /y "%tempFile%" "%%~fa" >nul 
    )
    exit /b 

:getBatchFileFullPath returnVar
    set "%~1=%~f0"
    goto :eof

which I had a need for at the time. Figured I’d share it as others might have a use for it too.

TR

1 Like

well, not a script to do that, per se
is your machine a mac or do you have access to a unix/linux system? [macs have a unix-like shell you can access as a command-line interface.] if not, you might want to try cygwin or sed for windows. if you go this route, what you want to accomplish is dead simple :

	for f in *.mdl; do
		sed '/^node trimesh/a\
	  shadow 0' <$f >$f.txt
    done

this non-destructive approach will leave your new models named as mymodel.mdl.txt, which you can then simply rename, overwrite the old, or whatever.

alternatively, if this doesn’t have to be done today, pm me and i can convert them for you.

EDIT : ahhh, i just noticed you posted this 10 days ago… :dizzy_face: sorry haven’t logged in lately… if you still need to convert these and want help, feel free to pm me.

2 Likes

Hidden in Plain Sight on this Site

Turns out there was a tool that works well at removing shadows (and does a number of other fixes too) - Clean Models. Fast, efficient and a GUI too. Wish I’d thought of it earlier. My only gripe about the version I used is that it indents by 4 places when it outputs instead of the 2 that I am used to. Cest la vie. Anyway version used is Clean Models:EE (other versions are available).

TR