SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH4 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=219)
-   -   [TEC] Ambient Occlusion Tutorial (https://www.subsim.com/radioroom/showthread.php?t=136354)

rodan54 05-06-08 04:15 AM

[TEC] Ambient Occlusion Tutorial
 
This, hopefully easy to understand, tutorial is meant to allow prospective and current SH4 modelers a means to create those tricky Ambient Occlusion texture maps for their future shipping releases.

Anyhoo, before getting started I just want to make a few notes.

1. This was all done in 3dsmax 9, so methods in other modeling suites may vary.
2. This is done using a completely original Mesh, so don't assume that it works in the same way for modded/kitbashed stock ships although I'd imagine it'd be pretty similar.
3. I haven't spent too much time adjusting the various parameters mentioned throughout this tutorial, so feel free to experiment.
4. Finally, I don't claim to be literate with 3dsmax in anyway shape or form, and am still slowly learning; therefore, if there are any errors, ommissions, or perhaps better methods than what is desribed here, then please do say so. :)

----------

Lets begin.

1. First of course you'll need to load up your model into max. Once that is done then navigate along the top menu bar to 'Rendering', and click on 'Render' in the roll down menu. This will bring up the 'Render Scene Dialog'. Now under the 'Common' tab navigate all the way down to the bottom and expand out the menu with the header 'Assign Renderer', click on the box next to 'Production' and select Mental Ray as the rederer. Click "Ok" and close out the 'Render Scene Dialog'.

http://img87.imageshack.us/img87/9211/30354608et6.jpg

2. Alright now with your ship selected, go back to the 'Rendering' menu list and select 'Render to Texture' which will open a new menu. For this perticular example my Tone model was not uv mapped, so in the 'Mapping Coordinates' section I have 'use automatic unwrap' checked which will generate new uv coordinates to be used by the Ambient occlusion map.

http://img146.imageshack.us/img146/4707/23876460aa2.jpg

3. Just below the 'Mapping Coordinates' section is the 'Output' roll out in which you'll want to add an 'Ambient Occlusion (MR)' from the list of available options that opens up.

http://img373.imageshack.us/img373/4903/68150581vg1.jpg

4. Once that's done then scroll down a bit more, and set the maps size for 1024x1024. In addition set the number of samples to 80 and spread to 1.0 in the 'Selected Element Unique Settings' section. Also under 'Automatic Unwrap Mapping' set the spacing to 0. Leave everything else as is and click 'Render'.

http://img360.imageshack.us/img360/4140/37045632me2.jpg

5. It might take a little while for max to compute all the numbers, so go get a cup of coffee while you wait. :o Once max is done rendering, and if you followed the tutorial properly then there will be a texture at the location specified previously under 'General Settings' in the 'Render to Texture' menu that should look something similar to this.

http://img146.imageshack.us/img146/6...tambienqq9.jpg

Hmm, not too bad.
Here's the Tone with ^ applied. And yes she is a WIP just in case anyone felt like pointing out her missing anchors.

http://img87.imageshack.us/img87/804...nrenderyo9.jpg

----------

keltos01 05-06-08 04:33 AM

waow
 
just what I was missing ! will post image when my Jyunsen B is rendered :D

damn ! I have to redo the conning tower now:nope:

thanks a lot

there goes what I've done :
http://img292.imageshack.us/img292/4...nboccluek4.jpg

is it normal that the option "ambiant occlusion mR" disappears from the menu when it's rendered to file ?

here applied to the mesh :

[url=http://imageshack.us]http://img183.imageshack.us/img183/6...appliedur1.jpg

skwasjer 05-06-08 04:54 PM

Does the 2nd map channel in S3D show you the correct uv map in the preview window? It sounds like the uv coordinates aren't right. If they are right though, then I'd like to have a look at the .dat.

Oh, and you may want to check if SelfOccEnable is true in the UnifiedRenderControler.

skwasjer 05-06-08 06:40 PM

The model is fine. But the problem you are having may be the key to some hidden data in the material chunk. I will want to investigate this further, but to do this I will need a ready to use mod with this dat-file. Do you have a testmod available for me, or can I just pick your current public release with this dat? I have been guessing for a long time about the remaining few bytes of materials (and am almost sure about some, just not 100%), and would like to find out.

One other thing I do notice is the node order. The 2nd material splits the first material. You may want to first try if moving the label and illum chunk directly after the parent material does anything.

skwasjer 05-07-08 11:05 AM

Hi Mikhayl, I've taken a look, and it's not a problem at all in the .dat. It's a problem with the texture. The artifacts you see in game are in fact not the ambient occlusion map itself (the AO map is rendered OK!), but the specular map that is rendered. I noticed this immediately because I only saw the artifacts when I moved the cam (iow. the angle vs the sun changed).

Then I looked at the O01 DDS, and there I saw indeed the AO map was also in the alpha channel of the texture, which is wrong. The alpha channel is reserved for the specular map. So, I copied a grayscale version of the T01 map (which is quick-n-dirty, you'd want to make a true specular map) into the alpha channel, and she rendered fine. This is the texture I used:

http://sh4.skwas.net/temp/NSS_Uboat2b_O01.rar

PS: You should also provide the extra mipmaps. You can choose this as an option when saving to DDS.
PS2: The AO map could use a little more detail.
PS3: The specmap uses the same uv-data as the diffuse map.

tater 12-11-08 02:50 PM

Punt for info.

Let's say you take an object from one ship (a carried boat, for example) and put it on another.

The occlusion map fouls up the way it looks where it is now. Do you need to export the ship plus the boat, then make a new o-map?

rodan54 12-11-08 03:41 PM

I'm pretty sure you'd just export your ship plus any new parts, position them accordingly in max and create the new AO map. Then import the separate objects back into the .dat and replace the existing AO map with the newly created one.

I think that's about what you were getting at.

miner1436 12-11-08 04:23 PM

How is the Tone coming along anyway?

keltos01 01-05-09 09:23 AM

copy of texture in alpha channel of _001.dds file
 
http://img206.imageshack.us/img206/8...hacopiecq1.jpg
http://img206.imageshack.us/img206/o...pg/1/w1680.png

I noticed a thing in the game's yourbeautifulsub_001.dds which I didn't do on mine :
there is an alpha channel under the 3 channels of the occlusion map image, but it has
not the occlusion map itself but a copy in B/W and positive of the
yourbeautifulsub_T01.dds file
with a higher ratio of contrast/brightness !

This is why my models were always so shiny : they were lacking that level of details in the alpha channel !

I will try and remedy to that.

I found it editing the UbootIXD2_001 file...

So much to find out still...

Keltos

runningdeer 06-04-09 03:56 PM

Thank you vm for this incredible tool. I cannot afford a 3D program.

I am new to skinning boats. But I am learning quickly. I have been using my photoshop CS3 to create and apply my skins.

One thing that I would like to be able to do is to place numbers or images on the left side of the boat, but have them going the right direction. I have worked with the occlusion maps to get the effect, but I understand that trying to edit the occlusion files with my photoshop is merely casting a shadow...and so I get that blurred look as well as only being able to use a black color against a lighter colored skin.

I was wondering if this tutorial would be the one to follow in order to learn how to apply actual font/image, and in any color.

Could someone please put me on the right track, so that I can learn this?

I did try googling 'occlusion mapping' and such like that, but found myself in a sea of confusion.

Thanx all for your time & help.

ichso 06-04-09 04:13 PM

I think I have to disappoint you there. As you know, you can't just paint some font onto your sub because there is only the right side of it used from a texture file and the left side is just a mirrored version of the right one.

The occlusion map however shows both sides individually but as I understand it, has nothing to do with coloring, just with lighting. It is one of those cheaper tricks to create shadowy effects on 3D objects without calculating actual shadow/lighting values (as would be done in ray traying for example).
So if you draw something on this occlusion map the particular spot will just be left out for shadowing/lighting. I don't understand this to it's fullest effect but it seems as if an area on the occlusion map that you change from this light grey color to something else is just not lighted at all when the texture is mapped onto the 3D object. And not being lighted means that is appears all black in the game.
This side effect can be used to display forms like fonts but no varying colors, I'm afraid.

What we would need would be that the game engine uses different texture information for both sides of the sub, which it simply doesn't do (was that different in SH3 btw ?).

runningdeer 06-04-09 04:20 PM

Ok...I suppose then that I need to learn how to create a new occlusion map.

Its either the Skipjack or Ohio SSBN sub mods that have the numbers on the tower.

Hmmmmm...:damn:.

ichso 06-04-09 04:39 PM

Occlusion maps won't help you much, I think.

But what just came to my mind is that in S3D you can set an id for the texture file being used and probably also change the uv map.

So, if you create a new, larger texture file (the ...T0x.dds ones) and give the 3d model a new uv map that referres correctly to this larger texture you might be able to make the game using different areas of the texture file for each side of the sub.
Just a thought.

runningdeer 06-04-09 04:41 PM

:woot:...man, I hope so ichso (that rhythms).

skwasjer 06-05-09 06:16 PM

You can use color in an AO-texture. Just understand that full white allows the original underlying color to pass through fully, where black fully blocks it. So when having some pixels as 'red' in an AO map, it will essentially only allow the red channel of the texture underneath to pass through. The technique can be used in a limited way though, since you can't paint/overlay white colors this way. It is however perfect for darkening areas of a model, or even tuning the colors a bit (due to light sources or whatever).

For adding text to a specific place on a ship, I recommend using decals. This is a simply geometric flat mesh, positioned close to the side of a wall for instance, and then you put a (transparent) texture on it. But you'll need a 3D program to create that mesh though.


All times are GMT -5. The time now is 09:23 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.