• Welcome to Twisted DIRT Forums.
 

News:

MX vs ATV Reflex PC Multi-Player back on line 10/8/2013.  Get Racing.

Main Menu

View Disp Map Utility v1.0

Started by DirtTwister, May 25, 2011, 01:17:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DirtTwister

http://www.youtube.com/v/q5lsY1jdo3Y

If you are converting tracks from MCM 2 or working on tracks with any kind of terrain variation in Paint Shop Pro, Gimp, or Photo Shop then you will find that scaling an 8 bit displacement map up to 1024x1024 or 2048x2048 is going to leave you with stair steps.  You need to convert them to a 16 bit or 24 bit value.    Leveller is an example of a tool you can buy that will let you convert to a 16 bit/24 bit bitmap.

I have created a utility that can be used as a quick tool to view your displacement map as a wireframe or textured and you can optionally smooth it and then save it into a 24 bit bitmap using 16 bit values.  This will preserve the smoothing and eliminate the stair steps.

Example stair stepped displacement map:

  http://dirttwister.com/images/reflex/stairstepped.png

Same Disp Map when smoothed using View Disp Map to smooth it:

  http://dirttwister.com/images/reflex/smoothed.png

Link to setup program:

  http://dirttwister.com/utilities/Setup_ViewDispMap_v1.exe


Some info from the readme that comes with the program:
==================================================

Known Issues:

If you get the following error you need the Visual C++ 2010 runtime.


"The program cannot start because MSVCP100.DLL is missing from your computer.
Try reinstalling the program to fix this error"


You can download the one you need here:
   
   32 bit: http://dirttwister.com/utilities/2010_cpp_redist/vcredist_x86.exe
   64 bit: http://dirttwister.com/utilities/2010_cpp_redist/vcredist_x64.exe




The first thing displayed when you launch ViewDispMap is a dialog requesting information.

Displacement Map:   The displacement map that you want to look at.  Should be either 1024x1024 or 2048x2048.

Texture:         The texture to use.  It should be the same size as the displacement map.

Smooth:             Defaults to 0.  When 0, the displacement map shows as is.  Values can be 0 to 100.  
                   Usually 1 thru 4 is all that you should need.

Scale:             The scale defaults to 1.  The bigger this is, the taller your displacement map will display.  
                   I find that 1 is good for SX size tracks and 3 to 4 is good for tall national size tracks.

                   
Commands while displaying the Displacement Map:

F1      Switch to wireframe.
F2      Switch to textured view.

F4      Save displacement map to a 24 bit BMP.  If you have smoothed your displacement map you can use this to
       save your displacement map to a 24 bit BMP.  The actual values saved are 16 bit.  The Blue channel
       isn't used.  The smoothed displacement map will be saved to the same folder as the original displacement map
       using the same name with _Smoothed16 appended to the name.
       
Q      Press the Q key to exit        

Moving around the Displacement Map:

You can fly around by using the mouse and the A and Z keys.  A moves you forward, Z moves you back, and the mouse will let you turn and point up and down.

DirtTwister

I'm going to claim this spot for problems and suggested changes.

Planned changes:

1. Preserve the settings between sessions, so if the smoothing process gets in the middle of your workflow you can have your last setting ready to go.

2. Add a  Smooth button so that you if you know what you want it will just smooth, save, and exit.

3. There is a bug in the plugin that I'm using, but if I can work around it, I want to make it where you can adjust the scale and smoothing level while viewing.  The terrain has to be destroyed and recreated to do either and there is a bug with doing that.

4. Let you configure the buttons to use and adjust the speed of movement.

Mace-x

may i suggest the ability to read .png images, im used to use these type of images and for some reason ps doesnt allow me to save it as bmp, so i gotta get it into paint and export it in bmp and i pressume that i loose qualit in this process.
thanks  :)

DirtTwister

#3
Quote from: Mace-x on May 27, 2011, 05:07:55 PM
may i suggest the ability to read .png images, im used to use these type of images and for some reason ps doesnt allow me to save it as bmp, so i gotta get it into paint and export it in bmp and i pressume that i loose qualit in this process.
thanks  :)

You should be able to use these formats: BMP, JPG, TGA, DDS, DIB or PNG format.  This only applies to the View Disp Map utility.  The track compiler will probably always just use BMP format because with directx they use the extended BMP formats.

I've only tested with TGA and BMP.

Try it and let me know how you make out.

Bruce

Mace-x

well, i've only used it with bmp and png, in 2048x2048.
bmp works perfectly but png crashes.
i've never used the other formats but i'll check as soon as i get back home.
thanks bruce!

DirtTwister

#5
I just tested with PNG files and it worked fine for me.  Can you send me the PNG file that crashes it?  In the next version I can change the filter so that it has those options.  I should also make it where it remembers what you have selected.

Mace-x


DirtTwister

#7
The images need to be 24 bit images.  Your PNG was a16 bit gray scale. It Paint Shop Pro it was showing 256 colors.  I'm not sure if there is any tool that will preserve 16 bit gray scale when you convert it to a bmp file.  In my utility unless I write an importer it is limited to whatever Dark Basic Pro supports for images.

I increased it's color depth/mode to RGB and 8 bits per channel and it worked fine.  

JamieT

Hey Bruce,

I have just scaled a disp map at scale, 1.1

Then I imported it into the reflex editor, and set up my scaling value that I know gives me the correct height I need. (which is 3.98 for a height of 514ft) I look in the objects tab, and the scene looks to be scaled correctly.

But once I get into the game, the height is as it was when I viewed it in the 'ViewDisp' tool (Almost flat).

So my question is, what height values do the scale values represent in ViewDisp?


Thanks

-Jamie

JamieT

OK, Sorry guys... it's been a long day.

My problem was that I hadn't saved a reflex track file before I exported as a beta track. Pure laziness on my part!

But I do have something to report in relation to importing disp maps after they've been smoothed, and what happens to your scale in the editor. For 2048 maps atleast, you need to double your scale value otherwise the terrain will be double the height! I guess this means theoretically, you could build a map with 4096 feet of elevation?! That's 1.2 kilometers! lol :P

Cheers

al167

also jamie remember to have atleast one fully white pixel and one fully black on your disp map before you put it in the view disp utility,  otherwise the heights of your hills jumps ect wont be the same after you save it(F4). this happens especially when you smooth it. im not shure about scale i havent used that feature yet....


JamieT

Thanks Al!

I forgot to check whether the re-sampling after the smoothing, had, had an effect on the min and maximum height values...

So that was why my disp map had grown almost twice the size after I smoothed it... lol thanks bro, like I said, it was a long day....

So 4086ft elevation is NOT possible... :D hehe


Cheers

JamieT

#12
Hey Bruce,

Could you please explain a little more about how these bitmaps are saved?

I've been attempting to create my own, by rendering the channels in 3Ds max, and so far it going good. I can replicate the same effect as what is created by the View Disp map tool. With the green channel having 256 steps of going from black to white.

The problem comes when I import into the Reflex editor, I get a very spikey terrain, and whenever I scale to anything other than 1.0, I get a speckled noise filter effect.

So I think my problem is with the channels and their bit/channel. I am saving in Photoshop 7, and I have a feeling that it's not saving in the correct format that the ViewDisp tool does. Are there any other graphics programs that will allow me to save in the same format? Or possibly add a feature to the ViewDisp tool, that will allow us to import custom Red and Green channels, and then save them?

Thanks

-Jamie


-----**Edit**-----

Ok, my problem is actually the rendering in 3dmax. The 256 divisions that are calculated when I render the green channel, are not the same as the divisions of the colours when I render the red channel. If that makes sense?

Are there any well-known rendering methods / settings I need to use? Or maybe some format standards I need to research for rendering in 3dmax?

I have been reading on here over the years, about the Daylon Leveller program.. I have yet to use it, but I'm guessing that this program will do the rendering job I want... but I doubt this program has the modelling freedom and functionality that 3d max has?...

Hope somebody can help with this

Cheers

JamieT

Just an update...

I got this a little more figured out. It was a problem with 3D max's saving format.
Saving the renders as a TIF image, with 8bits per channel (grayscale), no compression, seems to be the only format that retains the exact color information. Any other format will, for some reason, create artefacts in the image, hence the spikey terrain I encountered.

Although I figured this out, it's still only about 99% accurate. There are still afew errors that occur with max when I render my red channel. It doesn't divide the colours exacly the same as the divisions in the green channel. Which is really frustrating, because as I say, its almost perfect, but the error leaves what looks like rabbit holes, in the terrain.

Another problem that I'm encountering, is the render output size. The size seems to scale with the zoom in my active viewport, and never seems to match what I enter in the custom value boxes. Not sure why this is... but I'm guessing there is some form of resampling going on in 3dmax, from the value I enter as the custom size, to the resulting 1024 image.

I know my problems are very '3d max' specific, but hopefully someone on here uses 3d max right?... :-\

Sorry to turn this into a blog, rather than a disscussion, (I've posted the last 3 replies) :P But hopefully someone else will find this info useful, as I think 3d max is a really good tool for making obstacles/tracks, and getting some really nice geometric shapes. There are some things on your track that can be very hard to make if you only use brush tools.

Fixer

I've used disp maps in max for setting up objects, shadows etc. but as far as making terrain, leveler is the way to go...at least that's the way everyone I know preferred but we were using older versions of max



JamieT

Just thought I'd provide an update to the problems I was having earlier in the year...

The way I was rendering in 3DS Max just wasn't accurate enough to match up the 65536 possible values within the Red & Green channels. There was no way I could improve this no matter how hard I tried.  I then discovered that I can render a 16 bit grayscale .png file in 3DS Max, which contains precise height values for the 65536 steps of elevation in a single image, which is far better than trying to construct 65536 steps by using separate Red & Green channels.  I was a little confused earlier in the year, about what it meant to have a grayscale image in 16-bit format, but now I realise what it all means (compared to an 8bit grayscale which can only store 256 values).

After rendering this 16bit grayscale, I found it difficult to find a program that could convert this image to one that uses the Red & Green channels.  The only one I knew of, was Leveller of course, so I made the $50 investment... and it worked a treat :)

I can now turn a 3D model of a track created in 3ds max, into a displacment map that holds 65536 height values! Loving it! :D And with the maximum possible elevation in Reflex, at 2048 ft, the sky is quite literally the limit :P lol

- Jamie