Projectile Lights

Everything about development and the OpenMW source code.
Post Reply
User avatar
Aussiemon
Posts: 7
Joined: 09 Aug 2016, 00:36

Projectile Lights

Post by Aussiemon »

Hello all,

After a week or so spent familiarizing myself with the project's structure and OSG, I've written what I believe is a reasonable approximation of magic bolt projectile lights in Morrowind, Feature #3523. As this is my first experience with C++, let alone OSG, I don't know if I'm ready to apply to be a developer, but I thought I'd still post here to see if I could find some helpful criticism and advice.

The comparison is here: Link

A bit of testing seems to show that the spell light color might change slightly depending on the spell, but it's a bit hard to tell. If this is the case, my next task would be to find some way of retrieving that information to set the light colors.

Please ignore the "added" indentations in a few places. VS2015 and Notepad++ can't see them, but Github thinks it can. Does anyone know why that might be, as an aside? Fixed!


Thanks!
Last edited by Aussiemon on 05 Dec 2016, 00:49, edited 2 times in total.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Projectile Lights

Post by scrawl »

Looks good. I have some very minor criticism, but I'll save that for when you create a PR (more convenient to comment on individual lines).
Please ignore the "added" indentations in a few places. VS2015 and Notepad++ can't see them, but Github thinks it can. Does anyone know why that might be, as an aside?
You've used tabs instead of spaces. We use exclusively spaces, in fact, our CI server will reject code that contains tabs ;)
A bit of testing seems to show that the spell light color might change slightly depending on the spell, but it's a bit hard to tell. If this is the case, my next task would be to find some way of retrieving that information to set the light colors.
Try using the showSceneGraph command in Morrowind, find the projectile node, and you can see the exact colors that are being used. Might be dependent on the color set in the ESM::MagicEffect's that the spell includes. It is also possible there is one light source per effect.
User avatar
jirka642
Posts: 117
Joined: 23 Aug 2014, 11:39
Location: Czech Republic
Contact:

Re: Projectile Lights

Post by jirka642 »

Aussiemon wrote:Please ignore the "added" indentations in a few places. VS2015 and Notepad++ can't see them, but Github thinks it can. Does anyone know why that might be, as an aside?
Please, do not use tabs for indenting.
OpenMW Code Formatting Conventions:
Note that the indention width is 4 spaces. We are not too strict about these rules, but if you use tabs instead of spaces, you have a decent chance to piss us off. Mixing spaces and tabs is not good.
User avatar
Aussiemon
Posts: 7
Joined: 09 Aug 2016, 00:36

Re: Projectile Lights

Post by Aussiemon »

scrawl wrote:Looks good. I have some very minor criticism, but I'll save that for when you create a PR (more convenient to comment on individual lines).

Try using the showSceneGraph command in Morrowind, find the projectile node, and you can see the exact colors that are being used. Might be dependent on the color set in the ESM::MagicEffect's that the spell includes. It is also possible there is one light source per effect.
High praise! Here is the pull request.

That command is very helpful.

I've examined two spell projectile nodes (relvel_damage, fireball_bar_uni) with different effects. Both nodes contained a single light (even with multiple effects) and different diffusion values. I'll see about pulling the diffusion value from the color set you mentioned next.

If you're able to see those images, do the light values correspond directly to OpenGL equivalents? Do Atten0, Atten1, Atten2 = constant, linear, quadratic attenuation values?
jirka642 wrote:
Aussiemon wrote:Please ignore the "added" indentations in a few places. VS2015 and Notepad++ can't see them, but Github thinks it can. Does anyone know why that might be, as an aside?
Please, do not use tabs for indenting.
OpenMW Code Formatting Conventions:
Note that the indention width is 4 spaces. We are not too strict about these rules, but if you use tabs instead of spaces, you have a decent chance to piss us off. Mixing spaces and tabs is not good.
That's a very helpful link, thank you! I should've guessed that this was the reason.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Projectile Lights

Post by scrawl »

If you're able to see those images, do the light values correspond directly to OpenGL equivalents? Do Atten0, Atten1, Atten2 = constant, linear, quadratic attenuation values?
Yes, they should. m_kSpec you can ignore, Morrowind does not use specular lighting.
User avatar
Aussiemon
Posts: 7
Joined: 09 Aug 2016, 00:36

Re: Projectile Lights

Post by Aussiemon »

Okay, I've implemented color retrieval, and testing shows that the blended values match the properties of the vanilla light nodes.

Are there any problems remaining with my implementation?
Post Reply