rF shadow resolution

Siggs

Hi everyone :)

So I'm keen on taking screenshots in rFactor, and I've tweaked everything to get some great looking shots. But there's one thing that always gets me, and thats the shadow resolution. Always seems to be blocky on the wrong car, in the wrong palce :eek:

I have the game maxxed out, and afaik the resolution doesn't depend on game settings, it's either the car or track? If so, is there any way to boost the resolution in-game (not spinner) to make those high angle shots look better? specifically open wheelers is an issue here...

fps isn't such an issue, as when I'm taking shots it tend to be solo cars. If I do get slowing with multiple cars, I'm sure it wouldn't be to hard to alter the game back.

Any advice is greatly appreciated!

Siggs
 
The shadow resulutions are defined in the track .scn file. The ShadowCaster or ShadowObject parameters have numbers attached to them, like this:

... ShadowCaster=(Dynamic, Solid, 128, 128)

The higher the number, the less blocky the shadow becomes. I have no idea why there are two numbers though, and what unit the actual numbers are defined in, nor why there are two numbers. I hope someone can shed some light on this.
 
Thanks for the info Jorgen!

Looking at that line, I'm guessing 'dynamic' shadows are those cast by the cars and debris. Maybe the 'solid' ones are the ones cast by bridges etc, track shadows. Althought the track shadows that effect the car, I dunno if they'd be dynamic of solid...

Time to do some tests in rFactor! :D

Edit:
Whoa, there are so many seperate instances for shadowcaster :eek: Individual tyre walls and grandstands, etc, some more complex tracks have an insane number! So I'm playing with that, but is there a way of upping the car shadow as well? I guess that would give more instant and appealing results :) Afaik the values in the plr relate to the menu settings, so would changing them make any difference? With modern F1 cars, and all their winglets etc, shadows as good as in the showroom would be great. Again, performance isn't an issue.
 
Last edited:
Dynamic shadows move with the sunlight, static shadows don't move at all (except of course, when the car is moving :D.
First try turning on shadow blur in the options.
If that doesn't do it enough for you, back up the scn file for the track, then open it in notepad, use replace > replace all, replace all of these *minus the brackets* with (2048, 2048).
(8, 8), (16, 16), (32, 32), (64, 64), (128, 128), (256, 256), (512, 512) and (1024, 1024). You probably won't find anything below 128, 128 but do it anyway to make sure. No need to look through the scn file, it will take forever :D

The numbers represent pixels, 128 pixels wide by 128 pixels high.

For the car, back up the car.gen file or sometimes it's called carupgrades.gen, (there will be 2 gen files, one is for the spinner the other is for the track. You want to edit the one for the track, which will be what ever one doesn't have spinner in the name).

Then do the same for the car's gen file.

That will put all the shadows on max and be sure to also leave shadow blur turned on.
 
Well I edited all of those values in one track, and all of them for one car in a mod too. So the track shadows are SUPER sharp now, the cars projected shadow still stinks. Here's the relevant part of the .gen file for that car;

//------------------------------------SHADOW AND COLLISION OBJECTS---------------------------------
<MAX> MeshFile=Form_shad.gmt CollTarget=False HATTarget=False ShadowObject=(True, Solid, 2048, 2048, fis_undershadow.tga) LODIn=(0.0) LODOut=(200.0)
<HIGH> MeshFile=Form_shad.gmt CollTarget=False HATTarget=False ShadowObject=(True, Solid, 2048, 2048, fis_undershadow.tga) LODIn=(0.0) LODOut=(150.0)
<MED> MeshFile=Form_shad.gmt CollTarget=False HATTarget=False ShadowObject=(True, Solid, 2048, 2048, fis_undershadow.tga) LODIn=(0.0) LODOut=(100.0)
<LOW> MeshFile=Form_shad.gmt CollTarget=False HATTarget=False ShadowObject=(True, Solid, 2048, 2048, fis_undershadow.tga) LODIn=(0.0) LODOut=(50.0)
MeshFile=Form_col.gmt Render=False CollTarget=True HATTarget=False LODIn=(0.0) LODOut=(200.0)

Actor=VEHICLE

Instance=COCKPIT
{
Moveable=True
MeshFile=<F1COCKPIT> CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(10.0) ShadowReceiver=True
MeshFile=<123>_driver.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(10.0) ShadowReceiver=True
MeshFile=<123>_Cpit_Details.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(10.0)
<HELMEXISTS> MeshFile=<helmcpit> CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(10.0) ShadowReceiver=True
<HANDS1EXISTS> MeshFile=<hands1cpit> CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(10.0) ShadowReceiver=True
}

Has is got anything to do with that last LOD being 200? Or can things like this be hard coded in 3D modelling programs? Can't think of much else myself...
 
Last edited:
That's because the car shadow is it's own image. Make a back up of fis_undershadow.tga, Then open it in image editor and enlarge it to 2048 x 2048, then sharpen up the edges in the alpha layer. *When you open it, all you will/should see is a black image, its the alpha layer that says what's what.

[ED] Make sure you save it as a 32bit tga with no compression.

[EDD] If that's all too confusing to do, you can try just removing fis_undershadow.tga from the gen file, then it will cast it's own shadow relying on the shadobject.
One step further would be to add a shadow to the body and wings etc themselves and remove the shadobject.
 
What would you recommend doing? :) From where I am, surely letting it cast it's own shadow with the 'shadowobject' parameter is the best option? I am a tiny bit confused by the last part though, you're saying that if I deleted this line, removeable parts would still cast shadows after they've come off?
 
Removable parts probably cast their own shadow. I only said that to include all of it.
 
I did some experiments yesterday, but I still cannot for the life of me figure out what defines the resolution of the shadow that the car casts in-game. While I have been able to get a super high-res car shadow in the spinner by using a ShadowObject attribute to the car's own body shape and setting the size to 2048, that trick doesn't work at all in the game. Instead the body becomes invisible and the game crashes when you leave the track...

I've also tried another form_shad gmt object which gave a slightly less blocky shadow, so I suspect it is related to this object. Making a copy of the car's own body shape and naming it form_shad.gmt doesn't work though, the shadow is still as blocky as with the original form_shad.gmt object, although it does have a new (blocky) shape that resembles the copied body.

It's going to be interesting to hear the answer to this question. :)
 
You don't want to make the body a shadow object, just make it a shadow caster, a shadow object wont render.
What your trying to do is getting pretty advanced and there is a lot to explain about how it works. So for just screenshots and videos, best to just do one of the things I suggested in an earlier post (#6).

If you want to learn about how shadows work, then that's a different subject :)

To explain shadow object's a bit more, open up an isi car in the vehicle viewer (or if you have simed use that) http://www.rfactorcentral.com/detail.cfm?ID=Vehicle Viewer then you can hide the car body and see just the shadobject all by itself.
It's not necessarily a copy of the car, it's more an individually modelled object resembling the shape of the car.
With the tag 'ShadowObject' it will be invisible but will cast a shadow. This is done to save fps, the higher poly car model casting a shadow can cause low fps.

[ED] Ok I think I see where you got confused, I missed a bit. If you want to make the car cast a shadow instead of using the shadow object, comment out the shadow object line in the gen file and add shadowcaster to the car body. Copy the details from the shadow object but without the shadow.tga

Take this
ShadowObject=(True, Solid, 2048, 2048, fis_undershadow.tga)
and make it this
ShadowCaster=(True, Solid, 2048, 2048)

Then put it in the body instance.
 
Last edited:
I have tried that, but it doesn't work. Here is what it looks like originally, using the shadow object definition:

shadowobject.jpg


With the shadow object commented out and a ShadowCaster added to the body, it looks like this, regardless of what values I use for the sizes:

shadowcaster-on-body.jpg


The undershadow is obviously missing, and the shadow resembles the body shape better, but it still looks like blocks of LEGO...
 
I have it turned on, yes, but you can still clearly see the shadow isn't well defined to start off with;

rFactor%202010-12-27%2012-31-04-08.png


And that's with 2048 set in the gen file
 
Last edited:
Ok, more details. I'm able to get a crisp sharp shadow in the spinner:

spinner-shadowobject-512.jpg
spinner-shadowobject-2048.jpg


by changing this line:

MeshFile=BODYV2_a.gmt CollTarget=False HATTarget=False ShadowObject=(Dynamic, Solid, 512, 512) LODIn=(0.0) LODOut=(200.0) Reflect=True

to this:

MeshFile=BODYV2_a.gmt CollTarget=False HATTarget=False ShadowObject=(Dynamic, Solid, 2048, 2048) LODIn=(0.0) LODOut=(200.0) Reflect=True

That trick doesn't work in the game though.
 
That's more mod dependant, some have a seperate gen file for the spinner, like mianiak said. Anything spinner, only effects spinner. The same is the case with higher LODs
 
I think you have found the limitation of the game, I just tried a few things and couldn't get it any better (different sized textures different objects casting shadow etc). I never noticed this before.
I think what it needs is some sort of hdr I think it's called, some effect over the top of the game to give it some sort of bloom. Isn't there plugins for that?
I dunno if AA could help. I have max AA settings and AA transp. on but still see jaggered lines.
 
There is a plugin for 'hdr', although its effectively just bloom.

Called 'ENBseries plugin', but trust me when I say I've spent MANY hours fiddling with it, and all the best features have a 'but'. There's always something detrimental.

Overall, it's better to get rF setup well without the plugin, it's not worth the hassle.

Be interesting to get a dev's perspective on this shadow issue though :)
 
Indeed it will. I just hope someone from the dev team can take a little time to explain it. One odd thing I noticed while looking at the ISI BMW Sauber F1.08 mod, which is pretty much a blueprint for all other F1 mods, is that the ShadowObject attribute seems to have two different syntaxes, one for the spinner GEN and one for the in-game GEN:

ShadowObject=(True, Solid, 512, 512, fis_undershadow.tga) (In-game GEN file)

vs.

ShadowObject=(Dynamic, Solid, 512, 512) (Spinner GEN file)

Does anyone know if there is an official document that describes these things, or is everything "guessing games" by looking at how other people did it?
 
the ShadowObject attribute seems to have two different syntaxes, one for the spinner GEN and one for the in-game GEN:

ShadowObject=(True, Solid, 512, 512, fis_undershadow.tga) (In-game GEN file)

vs.

ShadowObject=(Dynamic, Solid, 512, 512) (Spinner GEN file)

That's because in menu you have a car presented in an indoor scenery, therefore no scattered light from the sky illuminates it. And because of that you don't have that extra undershadow texture under the car.
This texture isn't actually a shadow from direct sunlught, but just a cheap way to make ambient occlusion effect.

As for guessing game - perhaps "Dynamic" means that texture size is dynamic and 2048, 2048 is just the maximum? Maybe using "True" instead o "Dynamic" will help?

Just guessing... :)
 
As for guessing game - perhaps "Dynamic" means that texture size is dynamic and 2048, 2048 is just the maximum? Maybe using "True" instead o "Dynamic" will help?

No need to guess, Dynamic moves with the sunlight and static stays still. ;)
 
In real world you don't have super-crispy shadows... edges are always blured more or less, depending on how close a shadow casting object is to surface, on which that shadow is casted and how much global lighting is there.

I get this...

shadowsu.jpg


...with 2048x2048 shadow resolution. Of course, shadow casting object itself has to be good. I decided to use 3d external model as we see it on the track and do some slight optimisations to it (throw out some objects from inside the cockpit, that wouldn't be casted none the less, throw out all materials and replace them with one simple, etc.).

Also, the higher game resolution, to better shadows will be with hi-res defined maps. When doing above screenshot, I didn't saw any difference between 2048 and 4096 shadow resolution, because rF was in 1280x720.. things can be different, when you play in full hd or higher res.
 
well the Spa picture I posted first page was using 2048 resolution shadow casting, and the original screenshot was 1920*1080. The car model is pretty high poly too. Shadows are not perfectly sharp irl, it's true, but they're also not blocky like my rF! xD My idea was to have better defined shadows, but still have shadow blur on so they'd seem more natural. You might say that's self-defeating, but the higher presicion shadows would still show through.
 
Yeah, your shadow looks a bit too blocky for your settings... weird.
 
No need to guess, Dynamic moves with the sunlight and static stays still. ;)

AFAIK static is for shadows that don't cast on cars (only trackside) and dynamic is for shadows which cast on everything. Nothing to do with the sunlight.


Uhm or are there to shadows in the carfiles? Dynamic (moveable) and static (undercarshadow)? I was reffering to those entries in a track.scn....
 
No need to guess, Dynamic moves with the sunlight and static stays still. ;)
So what does "True" do? ;)

I'm referring to this:
ShadowObject=(True, Solid, 512, 512, fis_undershadow.tga) (In-game GEN file)

ShadowObject=(Dynamic, Solid, 512, 512) (Spinner GEN file)
And why shadow is "Dynamic" in spinner, not in game?
 
Flaux, your right, I was wrong :blush: I just did a test with scene viewer and changed my dynamic shadows to static and sure enough they still moved with the sunlight. I apologise for the incorrect information, I was just going off what I have been told, I should have tested it myself before I spoke up.

I just tested the true tag too whilst I had it open, it worked and cast a shadow, the shadow moved with the sun but did not fall on cars, so my calculated guess is true means the same thing as static. But there is no documentation on true, only static and dynamic.

Dynamic in the spinner might be because the showroom floor is moveable, hence needing the Dynamic tag.
Set the spinner shadow to Static, reload the car and you will see it disappear.

[ED] I'm curious to LesiU, that pic of the smooth shadow, what tag did that have on the shadow caster?

[EDD] I'm pretty sure that the undershadow tga just replaces the default shadow texture. Maybe because it can be made smoother or maybe because it can be shaped to the car, I don't know for sure. I would like to know though.
 
Last edited:
Undercarshadow is an addon to the normal moving shadow.gmt of the cars 3d-model. If you compare GTR2 and rF ingame, you will see the difference when watching the cars. The undercarshadow is a tga which produce a non movable shadow under your car. That gives it a more, well, dunno, it is just more. Haha...

EDIT:

GTR2 no Undercarshadow
RS_spyder_07_dyson.JPG



rF with undercarshadow (see the brighter moving shadow and the darker undercarshadow near the cars edge) BTW: Can't wait for the proto-C mod. GO VLM!
 
Last edited:
Exactly, the undershadow just makes it darker underneath the car, which looks more realistic. I'm still curious as to why the projected shadow is so blocky in some mods while others have a more smooth shape. Can anyone from ISI elaborate further?
 
[ED] I'm curious to LesiU, that pic of the smooth shadow, what tag did that have on the shadow caster?

MeshFile=<gmt_file> CollTarget=False HATTarget=False ShadowObject=(Dynamic, Solid, 2048, 2048, undershadow.tga) LODIn=(0.0) LODOut=(40.0)

Don't bother that tga there. It has completly black alpha channel (so in fact there's no undershadow). Right now it's just a placeholder.
 
gunna keep bumping till I get a dev in here! :cool:

I don't have time atm, but I may well try with a different mod. I doubt it'll make any difference, but it;s worth a shot regardless.
 
Bump!
I'm also curious, what types of shadows are available and what exact differences are between them.
 

Back
Top