View Single Post
Old 10-06-17, 01:20 PM   #104
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by VonDos View Post
Today i've reworked a little superstructure's design. More linear and detailed
To be honest I can't spot the difference but we trust you

Quote:
Originally Posted by VonDos View Post
Next heavy work will be adjust portholes in right re-worked position...
Yep, that's the hard part

Quote:
Originally Posted by Kendras View Post
I'm interested !
Quote:
Originally Posted by VonDos View Post
@Gap yes, please =) explain!
Okay.

How it works

That's probably easier for you to understand if you look at stock files, than it is for me to explain. I suggest you to open Harbor_kit.dat using S3d, and to look for one of the house models contained in it. Let's take House08_A for example.
If you select its embedded 3D model, you will see that it got two map channels.

 
If you are not familiar with secondary map channels, be aware that the 1st channel is the UV projection used for mapping on an object its main texture; the 2nd channel, on turn, is used in SHIII, IV and 5 for mapping on the same object another texture (such as a specular, an ambient occlusion map, etc.), when the latter and the main texture do not coincide perfectly.


If you click on the export button, S3d will let you to choose whether you want to export only the main map channel or both channels, and it will respectively name them *.obj and *-uv2.obj . If you open those objects in a 3D application, you should note two things:
  • the first remarkable feature is that both objects have identical x,y and z vertex/edge/face coordinates, but different UV projections, but that's no surprise if you have read the spoiler above.
  • the second remark, is that the two objects use two materials each, the 1st material corresponding to the whole house, and the 2nd one being limited to a couple of "redundant" faces, overlapping the two main facades on the house model, where doors and windows are painted.

Let's have look at those material in Harbor_kit.dat now, so that we can discover how they are set.
Both of them are named Kit_00.tga, but they do different jobs, and they are set differently.
There is not much to be said about the 1st material: it got the day-time texture embedded and, as for the rest, it is set as may other materials in game. The 2nd material is a bit more unusual though; for a start, we should note that it got a texture map controller attached, being set as "Ambient Occlusion" and with a night-time texture embedded. The second remarkable feature is the CityLights controller also attached to it, with DayIntensity and NightIntensity values that can be used for adjusting the transition from light to darkness.

Summing up, we have two texture maps and two materials, with four possible combinations of them. If my guess is right, only two combinations are active in game though:



The combination of UV map #1 and material #1 is the texture we normally see. Below a certain ambient light level, as set with the DayIntensity parameter, the combination of UV map #2 and material #2 start being gradually applied to the regular texture, until it reaches it maximum when ambient luminosity falls down the level set with the NightIntensity parameter.

I ignore the detail of how game shaders blend the two textures together, but it is possible thatthe night nexture it is applied to the main texture as a self-illumination map, or as a combination of self-illumination and ambient occlusion map.

How to set 3D portholes to emit light only at night

- Once you have finished moving/rotating them, group all the porthole glasses in a single object, separate from their ring-shaped frames and from the remaining ship parts. If you want, you can send the resulting object to me, for me to weld the redundant split edges (thus reducing vertex/edge count) and to rework a bit the UV map.

- After that, you should duplicate the object, assign a different material to each of the two copies of the porthole-glass-object, and re-group the two of them in a single object.

- When you have finished, export the resulting object two time, using the names whateveryouwant.obj and whateveryouwant-uv2.obj

- Create an empty library (dat) file, and copy the following chunks from Harbor_kit.dat in the new file:



 
A recommendation: Copy the chunks using the Ctrl **** C key combination to copy the chunks with all their subchunks. You could as well add the chuncks manually, using S3d's 'Append new chunk' or 'Append new child chunk' menus, but while working on specular maps, I have noticed that sometimes freshly created chunks, or chunks copied from an unappropriate file, don't work as supposed (I guess there might be some unknown special flags/properties that can't be seen nor edited in S3d, though the program can read/write them)


- Make sure that you have remapped all the Id's, and import the recently exported object in the 3d model chunk. If you select the one with the shortest name, S3d will automatically the one with the -uv2 suffix in its name, and it will give you the option to import it.

- Replace the textures embedded to the two materials with appropriate ones. Unless you want to paint some detail on them (like dust, sky reflections or smooth light transitions), you won't need big textures. Even the minimun size allowe (4x4 pixels IIRC) would be okay. The main texture should be painted with a shade of dark blue-grey or whatever you prefer, whereas the night texture can be painted light grey, almost white, or in a very bright tone of yellow.

- At this point, you can link the illuminated portholes to the main model through eqp file. you might also want to create a non-illuminated version of them for usage after war start.

That should be all. More or less the same method could be used for making ship surfaces, like decks and walls, illuminated at night, but for smooth light transition effects we should remap the UV projection of the second map channel, and create an appropriate texture. Probably too much work for a ship we will seldomly see in game in her neutral configuration

Quote:
Originally Posted by Kendras View Post
By the way, there are also light halos (texture) to add for position lights (green and red, and on the masts) : I don't think they can be controlled to be switched off during day time.
The method I have described above apllies to gloving lights, but who knows, maybe we can device some trick for making it to work with light halo effects too. Imagine how cool would be our lighthouses if we manage making their light to fade away during the day and to become proportionally more shiny at night
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote