This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [C++] LightAdder  (Read 13103 times)

tehrob

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [C++] LightAdder
« Reply #15 on: March 20, 2014, 06:00:28 pm »
Quote from: "schlumpf"
Quote from: "natrist"
I have noticed that the lighting disappears if you get the camera away from the light source.
Is this caused by a bug in your application or the game client itself?
It is a bug in the application: In the m2 header, there is a bounding box used to determine if the client needs to draw it. This is also used to determine if light sources from that model are used. When adding the light, the box needs to be extended to contain the maximum range of the light. If you don't, you can only see the light as long as at least a pixel of the bounding box is visible.

and how it is possible to extend this bounding box?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [C++] LightAdder
« Reply #16 on: March 20, 2014, 06:30:07 pm »
Quote from: "tehrob"
Quote from: "schlumpf"
Quote from: "natrist"
I have noticed that the lighting disappears if you get the camera away from the light source.
Is this caused by a bug in your application or the game client itself?
It is a bug in the application: In the m2 header, there is a bounding box used to determine if the client needs to draw it. This is also used to determine if light sources from that model are used. When adding the light, the box needs to be extended to contain the maximum range of the light. If you don't, you can only see the light as long as at least a pixel of the bounding box is visible.

and how it is possible to extend this bounding box?
http://www.wowdev.wiki/index.php ... tLK#Header
Bounding boxes are at 0x0A0. Not sure which one is relevant, just update both. The first one should be the right one, though.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Heliocratic

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 6
    • View Profile
Re: [C++] LightAdder
« Reply #17 on: April 09, 2014, 08:23:24 am »
I'm going to try this out and tell you if I used/implemented everything right. I was bummed out when I got Milly's darker nights to find out torches don't actually produce light on their own. Now I have the power to change that, thanks.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vortalex

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 253
    • View Profile
Re: [C++] LightAdder
« Reply #18 on: March 06, 2015, 04:52:56 am »
For someone like me who knows absolutely nothing about emitters, knowing what values do what, and what size my values should be, is confusing.

Has anyone got a tool with a helpful interface that can do this? Or if maybe someone could make a picture that details what controls what, and what the outcome looks like?

I'm sorry but this is just too confusing for me.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [C++] LightAdder
« Reply #19 on: March 07, 2015, 10:52:03 pm »
Quote from: "Vortalex"
if maybe someone could make a picture that details what controls what, and what the outcome looks like?

So.... you know, there's that search box Up there.  Use it sometime. :)  The stuff you can find is pretty amazing. Generally if you're thinking about something and you're pretty late in the game, it's possible that others have already discussed and gossiped about it, using that search box can lead to a lot of helpful hints from those of the past.  :D  :(  ;)  :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vortalex

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 253
    • View Profile
Re: [C++] LightAdder
« Reply #20 on: March 10, 2015, 12:27:10 am »
Quote from: "PhilipTNG"
So.... you know, there's that search box Up there.  Use it sometime. :)

Gee.. thanks. I hadn't thought of that before, ya know? If you search lightadder yourself tyou can see there has been 1 other discussion about it, and it didn't answer my questions about what the values meant.

Schlumpf gave a brief mention of what it meant, but to some of us that know absolutely nothing about how models work, it's very confusing.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vortalex

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 253
    • View Profile
Re: [C++] LightAdder
« Reply #21 on: March 11, 2015, 04:28:03 am »
Quote from: "schlumpf"
http://www.wowdev.wiki/index.php?title=M2/WotLK#Header
Bounding boxes are at 0x0A0. Not sure which one is relevant, just update both. The first one should be the right one, though.

Um, is there a specific application I should be using to edit an m2s header? I've looked around in 010 Editor and couldn't seem to find anything. I also looked around on the forums and saw that you gave this same answer to a lot of people, but never mentioned how to edit the header.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [C++] LightAdder
« Reply #22 on: March 11, 2015, 11:47:56 am »
010 editor or any hex editor would be the correct tool. care to elaborate on "couldn't seem to find anything"? if there was nothing at that offset, the file would be seriously broken.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vortalex

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 253
    • View Profile
Re: [C++] LightAdder
« Reply #23 on: March 12, 2015, 07:07:55 pm »
Quote from: "schlumpf"
care to elaborate on "couldn't seem to find anything"?

I ran a search for VertexBox using 010 Editor, and couldn't find it located anywhere. The wiki says it's located at 0x0A0 but I couldn't find that anywhere either. I'm probably doing it wrong, but that's exactly what I'm saying... I don't know how to mess with models, so saying it's located at 0x0A0 tells me absolutely nothing.

I did however add the model to GameObjectDisplayInfo.dbc and tried editing the vertices columns, but when I spawned it in-game it made no difference. It acted as if I hadn't edited the vertices at all. So, I'm really not sure that the vertices are responsible for the issue where lights disappear when you turn your camera away from the model. Either that, or the client just looks to the actual models for vertices and skips over the columns in the GameObjectDisplayInfo.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vortalex

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 253
    • View Profile
Re: [C++] LightAdder
« Reply #25 on: March 17, 2015, 03:17:38 am »
I can't get the RBG to work correctly. Every color I add always turns out white. Anyone know what could be causing that to happen?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [C++] LightAdder
« Reply #26 on: March 17, 2015, 01:36:10 pm »
It likely is 0-1, not 0-255.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vortalex

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 253
    • View Profile
Re: [C++] LightAdder
« Reply #27 on: March 17, 2015, 04:35:20 pm »
Quote from: "schlumpf"
It likely is 0-1, not 0-255.

Yeah, I figured that out, but even still the colors were all white. Here is some info I grabbed from a torch that gave off light:

---TORCH:
type 1, bone 1,
ARGB 1 1 1
AI 0
DRBG 0.466667 1 1
DI 3

In-game, this torch turned out orangish-yellowish, so I used this same info for some other models, and they all turned out white instead.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Magnus

  • Moderators
  • Wiki Incarnate
  • *****
  • Posts: 147
    • View Profile
Re: [C++] LightAdder
« Reply #28 on: April 04, 2015, 08:56:17 pm »
Have tried that tool und it gives a nice effect.

Unfortunately you have heavy faults of light reflection on floor (whole chunks) and buildings.

Depending of your POV the whole floor of a chunk (cell) get massive darker. The same with buildings. So you have a flickering effect when you are moving.

Don't know if it's possible to reduce this effect by setting other values.

(BTW: I use serverside spawned lamps. In this case I do not have the bounding box bug. At least I can't see it.)

Edit:
Ok, it seems that you shouldn't have more than 1 light emitter per cell (or too close). Than it looks pretty cool.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

jorgequintt

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 3
    • View Profile
Re: [C++] LightAdder
« Reply #29 on: May 11, 2016, 09:24:06 pm »
For the newbies like me who are just starting with this, here are a few things I learned these days playing with the values inside struct Light with the 101 editor:



This float inside Struct Light  > ABlock_f diffuseambient > SubAnimBlock_f Substruct is the size of the light. Change it to make it bigger/smaller. Default value is 3



These 3 values change the light color. 1st is red, 2nd green and 3rd blue. If you want your light to be only white you should set them all at 1.

If you have a problem with the light appearing where it shouldn't/not appearing at all, try changing this value to 0:



I guess that's all, I'm currently trying to figure how to stop that flickering thing with the lights when they aren't in your field of vision but I've made little progress. I managed to reduce the problem a bit by changing the VertexBoxMin and VertexBoxMax to x10 their default value, but they still appear/dissapear. I about to surrender and just make the lights smaller so is not noticeable :lol:
« Last Edit: January 01, 1970, 01:00:00 am by Admin »