SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   [TEC] Adding/Importing new units / SH5 Damage/collision models (https://www.subsim.com/radioroom/showthread.php?t=182667)

Rongel 05-04-11 12:11 PM

I'll list here our current situation, TDW and Zedi can comment if you have something to correct:

Good things :D

- High quality, functional ships imported from SH 4 with all maps and textures working
- Illumination, sun affects ships lighting
- Ships take damage from Deck Gun and Torpedoes
- Damage graphics (holes and internal structure) show when looked underwater
- Possibility to add SH 5 wakes
- Animated, fully working Sh 5 crew
- Possibility to add SH 5 or Sh 4 guns and instruments to ships
- Basic importing is fast

Bad things :nope:
- Ships don't cast shadows
- Ships don't reflect through water when looked above waterline
- Illumination anomaly (wrong side of the ship illuminated) when camera is really close to ships
- Damage graphics (holes and internal structure) don't show when looked above waterline
- Guns are rendered completely black, Sh 4 guns show textures only when camera is really close to ships
- Caustics show only on one side (SH 4 feature), Sh 5 caustics don't seem to work

Uncertain things (haven't been tested yet) :06:
- Flooding modelling is unfinished
- Some ships seem to bounce and roll too much when travelling

Zedi 05-04-11 12:31 PM

If im going wild and I create a ship in Max, how would I import it in SH5? Is that possible at all?

Rongel 05-04-11 02:38 PM

Quote:

If im going wild and I create a ship in Max, how would I import it in SH5? Is that possible at all?
It makes my head hurt just thinking about it :wah: Who knows, maybe it's easier than this stuff!

By the way, one weird thing I have noticed is that we can edit .val file, and the changes show, we can make a nice wake and foam, but why is .sim forbidden? I mean I can edit it in S3D or in Goblin, but haven't seen any changes in game. And it contains all the nice stuff, reflections, caustics and so on....

TheDarkWraith 05-04-11 05:25 PM

Quote:

Originally Posted by Zedi (Post 1656646)
If im going wild and I create a ship in Max, how would I import it in SH5? Is that possible at all?

Export to .obj format. Create new Type 4/0 node and import 3D model into it (using Pack3D). I can do this really fast using hex editor....

@ Rongel: if you look at the ships I sent you they all have the new SH5 wake controllers added. Look at the wakes (they even make their own waves at high speeds) :D

TheDarkWraith 05-04-11 07:34 PM

after much thought about why the caustics effect is only showing on one side (for DAT file units) I came to the conclusion that the shader isn't 'interpreting' the normal map correctly. More specifically since the normal map is mirrored to the other side of the ship it will pose problems for the caustics pixel shader (upon looking at what the caustics pixel shader was doing I was correct). So I made some changes to the caustics pixel shader :DL
Here's what I've done:
the pixel shader takes the light direction and the texel normal and does a dot product on them (both of these are vectors). It then throws this into a saturate function which just clamps the value to between 0 and 1. Do you see the problem??? I do. If the light direction and texel normal basically point in the same direction (texel is facing light) the dot product value will be > 0. If they point in basically opposite directions the dot product value will be < 0 (texel is facing away from light). Recall the saturate function clamps to between 0 and 1. Now since the normal map is mirrored on the other side of the ship, the side facing away from the light will always have a dot product value < 0 (the light direction is from the object to the light source not the other way around). PROBLEM :timeout: To fix this I made the pixel shader for the caustics check the dot product value and if it's < 0 then flip the light direction (so now the light source is coming from the other side of the unit). Now caustics are displayed on both sides of the ship :yeah::rock:

THE_MASK 05-04-11 08:09 PM

Another problem solved , thankyou .

TheDarkWraith 05-04-11 08:31 PM

Here you can see the effects of my Caustics PS change. Clearly you can tell the sun is shining on the other side of the ship :D
http://www.subsim.com/radioroom/pict...pictureid=4181

Once again unlit side in brighter daylight. I increased the caustics effect range on the unit. Instead of rendering only to a little area next to the waterline it renders more up the side of the unit. Should it render even higher :06:
http://www.subsim.com/radioroom/pict...pictureid=4182

stoianm 05-04-11 11:45 PM

Quote:

Originally Posted by TheDarkWraith (Post 1656988)

very nice... will be cool if you will find a solution to put caustic on plants and rocks... i can not do that:damn:
btw... the water color is from last dynamic?... if yes you think is to much green?:hmmm:

TheDarkWraith 05-05-11 12:57 AM

Whoever wrote the Unified Render shaders needs their head examined :shifty:

[begin rant]
Let's see....caustics effects.....they are sunlight reflections/refractions off the water onto the unit.....so why would someone model them as sunlight striking the side of the unit :damn: I rewrote the pixel shader so that the light used for lighting calcs for this effect is modeled as light coming off the water and not from the sky. Now light is absorbed by water and reflected/refracted more underwater...this is a given. So why would someone model the caustic effect above water and below water the same :damn: Once again I rewrote this part of the pixel shader so that the caustic effects above water are much more vivid than below water. The light used for the light calculations for the caustic effects below water uses light coming from the sky. C'mon now, this stuff isn't rocket science. It's quite evident that the person who wrote this shader has no clue about nature and general physics :stare: And this is the first shader I've looked at...there are many more....:dead:
[/end rant]

Almost all the problems (I believe) we are having with rendering units with .dat files is because of the shaders.

Now I must pull out my reference books on shaders and do a little reading up/refreshing....

Rongel 05-05-11 01:30 AM

Great work TDW! I was concerned that the shader change would mess with other, regular ships, but nice to know it's only for the dat ships.

You know I did some progress too! I think I have eliminated the illumination bug/anomaly! I can use high LOD values, guns are rendered and the lighting is good! Ships take damage and it's seen underwater.

I did few things:

1. Used SH 4 stock Normal Map (I think there may be something wrong with our maps)
2. Assigned one (and only one) material to DMG_col-nodes. It seems the material has to be the last of the list in dat-file. The one that has no cfg#TXR text, but just a "1" or "2".

But yeah! We can take some of those Bad Things out of the list!:woot:

Try it out when you have time! And shouldn't you be sleeping at this time? Here is beautiful morning already!

Zedi 05-05-11 01:36 AM

Even Bdu is very impressed with this work you guys do! Here, a present from papa Donitz :D

http://i1232.photobucket.com/albums/...g?t=1304577285

Rongel 05-05-11 01:39 AM

http://i1138.photobucket.com/albums/...-05_091401.jpg

Some proof! Don't know if you can see it, but the guns aren't black anymore even when I'm far away from the ship. This wasn't possible before.

EDIT: Whoa! Spilled my morning coffee!

Zedi 05-05-11 01:53 AM

Quote:

Originally Posted by Rongel (Post 1657100)
Some proof! Don't know if you can see it, but the guns aren't black anymore even when I'm far away from the ship. This wasn't possible before.

EDIT: Whoa! Spilled my morning coffee!

Hope not on you keyboard!

And how about the search light?

AOTD_MadMax 05-05-11 02:27 AM

Hi,

i see that you are doing here a great job with converting ships from SH4 to SH5 and i beleave that you will fix all the small last problems.

If you need some more units you can get my ships i have build for SH4, fore example some US DD´s like the Porter Class.

http://www.aotd-flottille.de//FOTRS/...orter_neu1.bmp

PM me if you want them.

Regards

Maddy

Rongel 05-05-11 03:12 AM

Quote:

Hi,

i see that you are doing here a great job with converting ships from SH4 to SH5 and i beleave that you will fix all the small last problems.

If you need some more units you can get my ships i have build for SH4, fore example some US DD´s like the Porter Class.
Thanks and wow, great looking shot! :up: When the importing goes fine enough I think it could be added to game, but I guess that is up to Zedi, if he wants to use them in his new campaign fix.


All times are GMT -5. The time now is 05:22 AM.

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