Jump to content

VTF and light bounce


Recommended Posts

Hi guys,

Im trying to find out how to change the light transmittance (light bounce strength) of vtf files. I know this is possible as i've seen it used with the dev/reflectivity textures. At the moment all of the vtf compilers and plugins available seem to calculate this automatically but i want to be able to set it manually somehow. Apparently its all in the VTF header but i havent been able to figure out how to edit VTF header info.

Has anyone done this before?

Link to comment
Share on other sites

I was under the impression that it's just done via the actual colour values in the texture. I.e. brighter textures reflect more light during RAD. I could be wrong, though.

You're right but what Rob is looking for is the way of manually tweaking the value which would not affect the texture.

Link to comment
Share on other sites

huh? Im not sure what you mean there. Yes you are right in that, atm, it automatically looks at the texture, its overall colour and brightness and creates a bounce colour value and strength based on that information (When saving the VTF). However, although suitable for most situations, it doesnt always provide acurate results.

In the header there is a vaule for this which looks something like this:

Transmittance 128 97 28 10

The first three values are of course rgb and the final is the power of the colour bounce/reflectivity/light transmittance (whatever you want to call it) which is only read by VRAD when calculating bounce in the lightmap compile.

All I want to do is increase the power value so that my materials have more reflective power, however there is no way I know of editing the header info to tweak it, or set it maunally when saving the VTF.

Link to comment
Share on other sites

Interesting. I wasn't aware of this until you brought it up, but I had a dig around and I think if you ask Nem very nicely he might add an option to the VTFcmd tool to allow you to set the reflectivity.


Currently there is only a -noreflectivity option to disable its calculation but from a quick glance at the code it looks like it wouldn't take much to add the ability to manually set it.

Link to comment
Share on other sites

So lucky for you I'm going through an 'interested in programming phase'. I know, sad but you can blame it on my new job. I took a look at the code and it only took about 5 new lines to add in the option to set reflectivity. Thanks to Nem and Wunderboy for having the code in such nice order :D

You will want to download VTFEdit from the link above. (I'm not sure if you get VTFCmd with it, if not download the VTFlib package too.)

Then copy this modified version of VTFCmd to the same folder as the default one:

VTFCmd_r.rar (Edit: Link removed until I talk to the coders -ifO)

Then you should be set. Here's an example run I did:

VTFCmd_r.exe -file ifO_cgbrick02y.tga -format dxt1 -mfilter box -reflectivity 0.6 0.6 0.6 -noreflectivity

NOTE: you must use -noreflectivity option (to disable standard calculation) as well as specifiying your desired values using -reflectivity.

Then open up the resulting VTF and check in the info tab, all looks good!


I'd be interested to see what results you get with this. Keep us informed if it's at all useful! :D

NOTE: Of course this file is useless without installing the original package, but still PLEASE DO NOT REDISTRIBUTE it, especially don't repackage this in with Nem's files or anything silly like that. I will contact Nem to make a proper addition if it proves to be worthwhile. I will take the link down shortly too.

Link to comment
Share on other sites

No problem, hope it works! A handy technique is to put any frequently used command in a batch file with %1 in place of wherever the input file should go, then you just drag and drop all your input files onto it. Combine this with VTFCmd's handy recursive option, which allows you to pass it a folder of input files and make a batch file like this:


vtfcmd_r.exe -folder %1\*.tga -recurse -reflectivity 0.4 0.5 0.6 -noreflectivity

... then drag a folder full of input .tga's onto it and it will VTF them all for you.

Link to comment
Share on other sites

Ok here's my results so far:


Gives alot more ambient light in indoor areas which is pretty nice. However I still found the whole process of tweaking the vaules of the textures very fiddly and drawn out, especially considering I'd have to tweak colours and strength on a per-texture basis, so im not sure im gonna use this just yet, but it nice to see the results of it.

Link to comment
Share on other sites

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.

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.

  • Mapcore Supporters

    Our incredible Patreon supporters keep Mapcore's lights on. If you'd like to donate, check out our Patreon announcement.

    Note: This is brand new! The format will be tweaked and rolled out to more pages soon.

  • Create New...