Jump to content
Sign in to follow this  
m1lkm8n

How to import a normal map sat image

Recommended Posts

Edit- I should add that this is more of a "thinking out loud" explanation. Thanks Bushlurker.

This may open up other issues like missing ground textures. While this guide may let you see and test out the new normal map it's obviously not the way bis handles importing mask/sat/normal maps. I was hesitant to post this for that reason but there's no reason why you can't check it out as when making a genuine a3 map they will come into play.

Ok guys. We've been hard at work tearing into a3 and figuring things out.

After bushlurker pointed out that mco textures looked like they'd been replaced with NO(normals).

And that it would most likely be during the sat/mask import stage I began wondering how to go about doing it without new tools.

We get what we've got here except inside the rvmats(which we'll get to in a bit) I missed the pixelshader=terrainSNX, which badbenson so kindly pointed out and BAM, now we have normal maps functioning.

So what we've got here is how to import a normal map for your sat image.

I'll go through a quick process of how to create and import.

First if you have l3dt it will generate the normal map for you.

In visitor3 first import your normal map in place of the sat image. Then the regular mask image. After import convert the .pngs to .paas andmove the rvmats and the sat.lcos to another folder on the p drive.

Then run the mighty mikeros mat14.exe (which is now available on his dev heaven page) on the folder with your newly generated rvmats and the sat images (which are actually the normal map images).

This program will rename the sat images to the correct NO images AND change every rvmat to the correct a3 style rvmat with new stage14(hence mat14)

:)

After that's done you can now import the real sat and mask images. Convert the .pngs to .paas Once that's done copy the rvmats and the NO images from the other directory into your data\layers and overwrite the rvmats.

Now you can binarize the map (assuming of course you have already a .wrp file)and in game you can see how the normal maps replace where normally the mco textures would be and also how they add depth to the sat image.

heres an after shot:

http://i.imgur.com/pRY2D7h.jpg

heres a few from bad benson:

http://i.imgur.com/DpFzW4v.jpg

http://i.imgur.com/8jCtkpM.jpg

you can see some fine detail in the terrain now

edit-

also it should be pointed out that mco textures are no longer used in a3. From what we can tell we believe that they are being replaced with the Normal Layer. In your layer config you can omit the texture line by just leaving the quotation mark empty.

class Layers
{
 class sara_a2_asphalt
 {
   texture = "SMD\SMD_Sahrani_A2\Data\smd_sara_a2_asphalt_mco.paa"; <=======================> texture = "";
   material= "SMD\SMD_Sahrani_A2\Data\smd_sara_a2_asphalt.rvmat";
 };

Edit- to add Ian banks terrain normal fix!!

I was talking to Bushlurker about A3 maps recently, and thanks to a sample of the problem he kindly provided I've written a small script to correct this issue. The order of the rvmat stages in ARMA 2 BIS Maps and all proper ARMA 3 maps doesn't match what Visitor 3 outputs, and the ARMA 3 pixel shader ("TextureSNX") is using _nopx textures instead of some of the _co textures). I've stuck the script (and a link to download it) below. To run it you just need an installation of Python (almost any version should be fine, but it was tested on 2.7). You then place the script into your layers\ directory (with all the rvmats that mat14 has modified) and run it by doing:

p:
cd tag\mymap\data\layers
C:\Python27\python mat14terrainNtoterrainSNX.py

With most Python installs you can also double click on a .py file to run it.

Make sure you only run it once, otherwise it will shuffle the rvmat stages around again. Once it is done just repack and run.

Here's the script (which you can download as well):

import os, re 

stage_re = re.compile("Stage(\d+)(.*?)};", re.DOTALL) 

def texture_fix(match): 
   stage = int(match.groups()[0]) 
   body = match.groups()[1] 

   stage_map = { 
       6 : 5, 
       7 : 6, 
       9 : 7, 
       10 : 8, 
       12 : 9, 
       13 : 10, 
       5 : 11, 
       8 : 12, 
       11 : 13 } 

   new_stage = stage_map.get(stage, stage) 

   return "Stage" + str(new_stage) + body + "};"

for path in os.listdir("."): 
   if path.lower().endswith(".rvmat"): 
       file = open(path) 

       try: 
           text = file.read() 
       finally: 
           file.close() 

       file = open(path, "w") 

       try: 
           file.write(stage_re.sub(texture_fix, text)) 
       finally: 
           file.close() 

       print "Fixed " + path

So with the community effort we now tackled yet another aspect in a3 terrain creation.

M1lkm8n

Edited by M1lkm8n
  • Like 1

Share this post


Link to post
Share on other sites

Really Nice! Thx for your effort, Milk!

Share this post


Link to post
Share on other sites

First if you have l3dt it will generate the normal map for you.

In visitor3 first import your normal map in place of the sat image. Then the regular mask image. After import convert the .pngs to .paas andmove the rvmats and the sat.lcos to another folder on the p drive.

I have to create a normal map from my 20480x20480 satmap, right? In L3DT, there is only the option for "Terrain normals", deducted from a heightmap. If I import a texture map, the option is grayed out.

Or do you import your 20480x20480 satmask as a heightmap? Then "Normalizing" works, though a full version of L3DT is needed for that size....

Share this post


Link to post
Share on other sites
I have to create a normal map from my 20480x20480 satmap, right? In L3DT, there is only the option for "Terrain normals", deducted from a heightmap. If I import a texture map, the option is grayed out.

Or do you import your 20480x20480 satmask as a heightmap? Then "Normalizing" works, though a full version of L3DT is needed for that size....

I think it actually makes the normal map from the height map itself. I've generated it before I even had the texture map generated.

Share this post


Link to post
Share on other sites

Thanks for the share, But ahhh its all come flooding back the hours lost in visitor making sure my bushes looked pretty in peoples gardens, or if a shed was too close to a footpath :P , may give the above a blast see what I end up with, thanks again.

Share this post


Link to post
Share on other sites

Also bushlurker noticed in place of the mco in the stage 2 slot is what appears to be some sort of synthetic ground texture.

Looks like this : texture = "#(rgb,1,1,1)color(0.5,0.5,0.5,1,cdt)";

Share this post


Link to post
Share on other sites

Yea that's the issue with this workaround. It's not really 100%. It's more so people can test it out and see how it works. I haven't really had much time to continue messing around with it either to see if anything else can be done to correct it.

See what happens if you increase your base texture size.

Share this post


Link to post
Share on other sites
I have to create a normal map from my 20480x20480 satmap, right? In L3DT, there is only the option for "Terrain normals", deducted from a heightmap. If I import a texture map, the option is grayed out.

Or do you import your 20480x20480 satmask as a heightmap? Then "Normalizing" works, though a full version of L3DT is needed for that size....

You could probably export the terrain as a 3d mesh and bake the normals against a plane.

Share this post


Link to post
Share on other sites

hello

I am delighted your mapping A3 board, I built two maps, one personal and one that I want to deliver to the community armed with open souce as base dévellopement.

Still I can not use a Mat14, could you explain its use, thank you

Share this post


Link to post
Share on other sites

After you installed mat14, open command console and type :

mat14 P:\TAG\YourMap\data\Layers

This command will modify all rvmats and you're good to go ;)

Share this post


Link to post
Share on other sites

@PepinKR

j'ai réussi a transformé 1 rvmat dois je le faire pour chaque rvmat, la liste est astronomique ?

Pepin puis je m'inscrire sur the servants, je cherche un groupe arma ?

I got turned 1 rvmat should I do for each rvmat, the list is astronomical?

Share this post


Link to post
Share on other sites

@Gamma : add me on steam "kavarak"

Mat14 will do all rvmats at once do not worry ;)

Share this post


Link to post
Share on other sites
Hey M1lkm8n, do you have the same issue when using normals sat map ?

http://i.imgur.com/73pG6jh.jpg (248 kB)

http://i.imgur.com/aqJGUMj.jpg (247 kB)

I was talking to Bushlurker about A3 maps recently, and thanks to a sample of the problem he kindly provided I've written a small script to correct this issue. The order of the rvmat stages in ARMA 2 BIS Maps and all proper ARMA 3 maps doesn't match what Visitor 3 outputs, and the ARMA 3 pixel shader ("TextureSNX") is using _nopx textures instead of some of the _co textures). I've stuck the script (and a link to download it) below. To run it you just need an installation of Python (almost any version should be fine, but it was tested on 2.7). You then place the script into your layers\ directory (with all the rvmats that mat14 has modified) and run it by doing:

p:
cd tag\mymap\data\layers
C:\Python27\python mat14terrainNtoterrainSNX.py

With most Python installs you can also double click on a .py file to run it.

Make sure you only run it once, otherwise it will shuffle the rvmat stages around again. Once it is done just repack and run.

Here's the script (which you can download as well):

import os, re 

stage_re = re.compile("Stage(\d+)(.*?)};", re.DOTALL) 

def texture_fix(match): 
   stage = int(match.groups()[0]) 
   body = match.groups()[1] 

   stage_map = { 
       6 : 5, 
       7 : 6, 
       9 : 7, 
       10 : 8, 
       12 : 9, 
       13 : 10, 
       5 : 11, 
       8 : 12, 
       11 : 13 } 

   new_stage = stage_map.get(stage, stage) 

   return "Stage" + str(new_stage) + body + "};"

for path in os.listdir("."): 
   if path.lower().endswith(".rvmat"): 
       file = open(path) 

       try: 
           text = file.read() 
       finally: 
           file.close() 

       file = open(path, "w") 

       try: 
           file.write(stage_re.sub(texture_fix, text)) 
       finally: 
           file.close() 

       print "Fixed " + path

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×