Merging Opacity map from FreeWorld3D
by M Mahmud Hasan · in Game Design and Creative Issues · 01/12/2007 (7:44 am) · 13 replies
Hi,
I am building a terrain for TSE using FreeWorld3D. I wanted the terrain to use blended texture mode.
I have 4 layers in the FreeWorld3D terrain which are Base, grass, rock and sand. When I exported the layers I got 3 opacity map.
According to the FreeWorld3D instruction in the Torque Development Network article the opcaity map for these three layers need to be blended in a single 32 bit PNG.
For example,
Red channel = Holds the Opacity map for Base texture Layer.
Green channel = Holds the Opacity map for Grass.
Blue channel = Holds the Opacity map for rock.
Alpha channel = Holds the Opacity map for sand.
My problem is I need solid information how to add the raw files in each channel using photoshop or Gimp.
Can any photoshop expert can help me in this regard?
Thank you.
I am building a terrain for TSE using FreeWorld3D. I wanted the terrain to use blended texture mode.
I have 4 layers in the FreeWorld3D terrain which are Base, grass, rock and sand. When I exported the layers I got 3 opacity map.
According to the FreeWorld3D instruction in the Torque Development Network article the opcaity map for these three layers need to be blended in a single 32 bit PNG.
For example,
Red channel = Holds the Opacity map for Base texture Layer.
Green channel = Holds the Opacity map for Grass.
Blue channel = Holds the Opacity map for rock.
Alpha channel = Holds the Opacity map for sand.
My problem is I need solid information how to add the raw files in each channel using photoshop or Gimp.
Can any photoshop expert can help me in this regard?
Thank you.
#2
01/12/2007 (8:10 am)
Open photoshop, find the channels window, click the red channel, paste one map, do the same for green and blue and alpha.
#3
Thank you for your quick reply. As you said in the channel window I can paste the image in every channel.
I think I tried it but don't it was not working. DOes the staright pasting action work for this or do I need something to configure beforehand?
ow can I paste my raw file in the alpha channel? Could you give me some detail?
Thanks a lot for the support.
01/12/2007 (11:02 pm)
Hi,Thank you for your quick reply. As you said in the channel window I can paste the image in every channel.
I think I tried it but don't it was not working. DOes the staright pasting action work for this or do I need something to configure beforehand?
ow can I paste my raw file in the alpha channel? Could you give me some detail?
Thanks a lot for the support.
#4
(quick note this is assuming using windows, If your using that funky looking fruit computer(jokeing hehe) then I dont know the key strokes for it)
1.What you do is open a new file in photoshop and name it opacity(simple way of naming it).
2.Open up your base layer Alpha raw file, with that file open hit Ctrl+A to select all then Ctrl+C to copy it.
3. Select the opacity file window in photoshop, goto channels select the red channel and hit Ctrl+V and it will copy into the channel.
4. Then open up the 2nd layer alpha map and hit Ctrl+a then Ctrl+C then this do the same thing in #3 for green channel.
5.Repeat the same thing for Blue, to get your 4th channel you have to make a new channel should be the icon beside the trashcan on the channel controls box called create new channel, and put your last alpha map in it. Then save the opacity map as a SuperPNG file, it's a Free Plug-in for Photoshop, dont know if you really need this but it works so i'm not complaining.
PS and be sure to copy ALL the textures you used, to your game project directory, hehe I missed one of my textures and took my half hour to figure out why the map wouldnt compile thank goodness for Torsion love that program. :p
01/13/2007 (6:06 am)
Ok I finally got everything working last night on this topic thanks to Magnus. Gimp doesnt seem to let you copy alpha's into the channels for some reason but Photoshop will. One quick note was that if you dont set the base texture as a alpha also it would color the terrain black and every other alpha map would show up very bright on the terrain. After setting an alpha base texture I painted the whole terrain with it(still in the first slot like you would otherwise).(quick note this is assuming using windows, If your using that funky looking fruit computer(jokeing hehe) then I dont know the key strokes for it)
1.What you do is open a new file in photoshop and name it opacity(simple way of naming it).
2.Open up your base layer Alpha raw file, with that file open hit Ctrl+A to select all then Ctrl+C to copy it.
3. Select the opacity file window in photoshop, goto channels select the red channel and hit Ctrl+V and it will copy into the channel.
4. Then open up the 2nd layer alpha map and hit Ctrl+a then Ctrl+C then this do the same thing in #3 for green channel.
5.Repeat the same thing for Blue, to get your 4th channel you have to make a new channel should be the icon beside the trashcan on the channel controls box called create new channel, and put your last alpha map in it. Then save the opacity map as a SuperPNG file, it's a Free Plug-in for Photoshop, dont know if you really need this but it works so i'm not complaining.
PS and be sure to copy ALL the textures you used, to your game project directory, hehe I missed one of my textures and took my half hour to figure out why the map wouldnt compile thank goodness for Torsion love that program. :p
#5
Thanks a lot. I'll try your instruction. If I screw up something I'll put a post here for your help.
Hope you will help me as you did.
Great work!
01/13/2007 (12:39 pm)
Hi Cook,Thanks a lot. I'll try your instruction. If I screw up something I'll put a post here for your help.
Hope you will help me as you did.
Great work!
#6
I did the same thing as you instructed. My raw files for Opacity maps are 256X256.
Here is what i did:
1. I created a new psd file in photoshop (RGB mode).
2. Add a new channel (name, Alpha 1)
3. Paste my three opacity map one after another in Green , Blue and Alpha 1 channel.
4. The Red c hannel remain full white because for the base layer.
5. saved it in png using super png plugin.
Now my question is do you see the alpha chanel again if you open the png from photoshop?
or is it not viewable from photoshop.
I could not see the alpha 1 channel in the png. But i'll test the opacity map if it works okay for me.
Thank you.
01/15/2007 (3:55 am)
Hi Cook,I did the same thing as you instructed. My raw files for Opacity maps are 256X256.
Here is what i did:
1. I created a new psd file in photoshop (RGB mode).
2. Add a new channel (name, Alpha 1)
3. Paste my three opacity map one after another in Green , Blue and Alpha 1 channel.
4. The Red c hannel remain full white because for the base layer.
5. saved it in png using super png plugin.
Now my question is do you see the alpha chanel again if you open the png from photoshop?
or is it not viewable from photoshop.
I could not see the alpha 1 channel in the png. But i'll test the opacity map if it works okay for me.
Thank you.
#7
You have to use the OLD superpng plugin though since the new ones does it the "photoshop way" too. You can get the needed files at tdn.garagegames.com/wiki/Editing_Beginner/Tools/SuperPNG
01/15/2007 (4:00 am)
Mahmud; that's why you have to use SuperPNG. Photoshops own png filter doesn't do alpha channels (it saves it as "transparency" instead). You have to use the OLD superpng plugin though since the new ones does it the "photoshop way" too. You can get the needed files at tdn.garagegames.com/wiki/Editing_Beginner/Tools/SuperPNG
#8
Thank you for the old file pointer. I was trying by the new one.
Thanks a lot.
01/15/2007 (6:24 am)
Hi Magus,Thank you for the old file pointer. I was trying by the new one.
Thanks a lot.
#9
I got something wrong with my terrain.
I used FreeWorld3d to generate the terrain with 4 alpha layer. I got 4 opacity map as raw format and placed those opacity map in the new png file and saved it as super png. The heightmap was 512X512 and square size was 1.0
I used following script to generate the blended texture:
==========================================================
enableWinConsole(true);
setLogMode(6);
atlasOldGenerateChunkFileFromRaw16("Game/data/terrains/heightmap.raw", 512, 1.0, 0.001952, "Game/data/terrains/terrain.chu", 1.5, 5);
importOldAtlasCHU("Game/data/terrains/terrain.chu", "Game/data/terrains/geometry.atlas");
atlasGenerateTextureTOCFromTiles(4, "Game/data/terrains/Opacity", "Game/data/terrains/OpacityTex.atlas", 1);
atlasGenerateTextureTOCFromTiles(4, "Game/data/terrains/Lightmap", "Game/data/terrains/Lightmap.atlas", 0);
atlasGenerateBlenderTerrain(
"Game/data/terrains/terrain.atlas",
"Game/data/terrains/geometry.atlas",
"Game/data/terrains/OpacityTex.atlas",
"Game/data/terrains/Lightmap.atlas",
25600,
"Game/data/terrains/tile1.jpg",
"Game/data/terrains/tile2.jpg",
"Game/data/terrains/tile3.jpg"
"Game/data/terrains/tile4.jpg"
);
echo("done");
// We're done!
quit();
I got the executable is stucked in the atlasGenerateBlenderTerrain() call. Then I tried to use the atlas generator gui posted in teh forum. It generted the final atlas file but when i load the file I don't see the terrain at all. Can anyone have any hints about it?
Thank you for any kind of help.
01/16/2007 (5:06 am)
Hi,I got something wrong with my terrain.
I used FreeWorld3d to generate the terrain with 4 alpha layer. I got 4 opacity map as raw format and placed those opacity map in the new png file and saved it as super png. The heightmap was 512X512 and square size was 1.0
I used following script to generate the blended texture:
==========================================================
enableWinConsole(true);
setLogMode(6);
atlasOldGenerateChunkFileFromRaw16("Game/data/terrains/heightmap.raw", 512, 1.0, 0.001952, "Game/data/terrains/terrain.chu", 1.5, 5);
importOldAtlasCHU("Game/data/terrains/terrain.chu", "Game/data/terrains/geometry.atlas");
atlasGenerateTextureTOCFromTiles(4, "Game/data/terrains/Opacity", "Game/data/terrains/OpacityTex.atlas", 1);
atlasGenerateTextureTOCFromTiles(4, "Game/data/terrains/Lightmap", "Game/data/terrains/Lightmap.atlas", 0);
atlasGenerateBlenderTerrain(
"Game/data/terrains/terrain.atlas",
"Game/data/terrains/geometry.atlas",
"Game/data/terrains/OpacityTex.atlas",
"Game/data/terrains/Lightmap.atlas",
25600,
"Game/data/terrains/tile1.jpg",
"Game/data/terrains/tile2.jpg",
"Game/data/terrains/tile3.jpg"
"Game/data/terrains/tile4.jpg"
);
echo("done");
// We're done!
quit();
I got the executable is stucked in the atlasGenerateBlenderTerrain() call. Then I tried to use the atlas generator gui posted in teh forum. It generted the final atlas file but when i load the file I don't see the terrain at all. Can anyone have any hints about it?
Thank you for any kind of help.
#10
01/16/2007 (3:28 pm)
Your missing the , at the end of tile3.jpg". Heheh I did the same thing when I was learning to generate terrain.
#11
01/16/2007 (11:53 pm)
Thank you Cook. Thats a nasty mistake! :-)
#12
So guys if you have any suggestion on it please share with me. I'll be glad to know your expereince.
01/16/2007 (11:58 pm)
I successfully generated the terrin. One thing was that I was using too low height scaling while exporting the chu file. But I figured out the right value for mu terrain. One thing is interesting the blending is not that impressive in torque. I used a rock texture at the top of the mountain but it seems that the base texture is blended with the rock texture and the rock texture lost its charm :-). I think i have to modify the shader to improve it. Moreover the detail texture is not working. I have to look into that also.So guys if you have any suggestion on it please share with me. I'll be glad to know your expereince.
#13
Also at the end of the tutorial on the TDN for Freeworld3D he gives a code for a shader. I have to use it in order for blending to even work. Just make a backup of that file and put that code in its place. Should change things on how the terrain is rendered.
01/17/2007 (4:03 am)
Yeah detail texture is disabled no telling when were getting that back. I usually set Scale U And Scale V to 32 on each texture in freeworld3d to make the texture look better on the terrain. Don't do that for your lightmap tho get some strange things.Also at the end of the tutorial on the TDN for Freeworld3D he gives a code for a shader. I have to use it in order for blending to even work. Just make a backup of that file and put that code in its place. Should change things on how the terrain is rendered.
Torque Owner Cornell Cook