• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Need Help Dynamic lighting for location models

Myth

Freebooter
Good afternoon. Do we have people on the forum who understand the dynamic coverage of the location of the game? I'm talking about the light that is installed through scripts. Thank you.
 
Shore locations or in 3D Sailing Mode?
For shore, see here: Guide - Generating Location Lighting Files (.COL)
For sea, I haven't a clue because that feature was added after Storm 2.

no

Locations[n].models.always.l0.tech = "LocationModelBlend";
Locations[n].models.always.l1 = "plan_1";
Locations[n].models.always.l1.level = 8;
Locations[n].models.always.l1.tech = "LocationModelBlend";
Locations[n].models.always.l2 = "plan_2";
Locations[n].models.always.l2.level = 7;
Locations[n].models.always.l2.tech = "LocationModelBlend";
Locations[n].models.always.l3 = "plan_3";
Locations[n].models.always.l3.level = 6;

like shis
 
I will clarify my question: I'm wondering whether it's possible to add light to the location as a program, without editing the resources?
 
I will clarify my question: I'm wondering whether it's possible to add light to the location as a program, without editing the resources?
I know PotC:NH has a system that allows you to add new locators through code.
That way you don't need to edit the location GM files.
 
The Dynamic lighting ... included, weather (ini`s) , lightning files, col files and many textures files.
This is a huge puzzle ... that everything .. to vote ..have fun

They never asked themselves... why the game is so dark?
There they have their problem.
 
MEGA - good for day. But for night its bad.
 

Attachments

  • Безымянный2.png
    Безымянный2.png
    1 MB · Views: 221
  • Безымянный3.png
    Безымянный3.png
    1,001.3 KB · Views: 248
  • Безымянный.png
    Безымянный.png
    956.4 KB · Views: 239
col files ... are one of the 5 building blocks of lighting.
Why delete them? They are always created only for one .gm model.
 
The LocationModelBlend is the technique block that contains the DirectX commands correlated to SetRenderState calls. At the moment, it appears to only be used in the jungle/scenes outside town, but I'm sure one could write their own technique block and add that same attribute to other locations if desired. LocationModelBlend block is written in modules\techniques\maineffects.sha; look for the block LocationModelBlend section.

IDirect3DDevice9::SetRenderState method (Windows)

The left side of the equation in the pass p0 part, correlates to the particular render state and the name is usually easy to determine which renderstate it will affect:

D3DRENDERSTATETYPE enumeration (Windows)

Example: lighting will set D3DRS_LIGHTING, ambient will set D3DRS_AMBIENT, fogenable will set D3DRS_FOGENABLE, etc. Some of the right side of the = will set true/false, while others will get some integer value, depending on how DirectX desires the value for the particular state you are setting.

There is also another way built into the game to set ambient lighting, using loc_ambient.sha, but it doesn't work and has no effect. The developers intended to use the ambient settings in that file to affect the ambient light shades while inside different locations such as cave, house, tavern, etc. You can see this in the LoadLocation() function of locations_loader.c. However, as I mentioned, though it does call ExecuteTechnique in the back-end engine, it is done at the wrong time of the DirectX pipeline process, so has no effect on the ambient lighting at all; those render states need to be called at a different time. I am going to change the engine to enable that feature.
 
The LocationModelBlend is the technique block that contains the DirectX commands correlated to SetRenderState calls. At the moment, it appears to only be used in the jungle/scenes outside town, but I'm sure one could write their own technique block and add that same attribute to other locations if desired. LocationModelBlend block is written in modules\techniques\maineffects.sha; look for the block LocationModelBlend section.

IDirect3DDevice9::SetRenderState method (Windows)

The left side of the equation in the pass p0 part, correlates to the particular render state and the name is usually easy to determine which renderstate it will affect:

D3DRENDERSTATETYPE enumeration (Windows)

Example: lighting will set D3DRS_LIGHTING, ambient will set D3DRS_AMBIENT, fogenable will set D3DRS_FOGENABLE, etc. Some of the right side of the = will set true/false, while others will get some integer value, depending on how DirectX desires the value for the particular state you are setting.

There is also another way built into the game to set ambient lighting, using loc_ambient.sha, but it doesn't work and has no effect. The developers intended to use the ambient settings in that file to affect the ambient light shades while inside different locations such as cave, house, tavern, etc. You can see this in the LoadLocation() function of locations_loader.c. However, as I mentioned, though it does call ExecuteTechnique in the back-end engine, it is done at the wrong time of the DirectX pipeline process, so has no effect on the ambient lighting at all; those render states need to be called at a different time. I am going to change the engine to enable that feature.

I wonder how the game will look if you add the light that you mentioned.
 
I wonder how the game will look if you add the light that you mentioned.

I just got this coded into the engine yesterday and started experimenting with different ambient light values in some locations.

Now, the tavern shows an orangish light in the tavern, due to the firelight/candlelight, caves and dungeon are much dimmer; I'm still playing with numbers, but I like the fact that the intended effect now works, when it had no effect before. It now allows a little flexibility into how different location scenes are now rendered.
 
Back
Top