Skip to content

Comments

Coronas, ground curvature, glowing materials#513

Merged
rherriman merged 6 commits intoavaraline:mainfrom
rherriman:rendering-improvements
Dec 19, 2025
Merged

Coronas, ground curvature, glowing materials#513
rherriman merged 6 commits intoavaraline:mainfrom
rherriman:rendering-improvements

Conversation

@rherriman
Copy link
Member

No description provided.

fragmentColor = vertexColor;
fragmentSpecular = vertexSpecular.rgb;
fragmentShininess = vertexSpecular.a * maxShininess;
fragmentGlow = vertexGlow * maxGlow;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should either fix this line to just use the raw vertexGlow (and remove maxGlow from the shader entirely), or go ahead and replace the single 32-bit float in the vertex array with four uint8_t's similar to how specular/shininess are stored and follow that pattern. That would mean 3 uint8_t's would be "reserved" for additional material properties in the future.

I don't love that plan, but ultimately, it's occupying exactly the same amount of space as it is currently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...it also occurs to me that maybe simply reordering the layout of the struct would rectify the issue I was seeing. If I put all the floats at the beginning and the uint8_t's at the end, I don't believe I'll have the same padding issues.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually what am I saying, it's an array of these vertices, there will still be padding issues unless I reserve the padding explicitly.

@rherriman
Copy link
Member Author

I decided to go ahead and make glow a uint8_t in the vertex array after all, and reserving three additional spots for material parameters.

Normally I would be against wasting space like this, but I justified it thusly:

  • Before this commit, glow was already being represented by 32-bits,
  • The reserved slots would be a good place to fit in some of bobski's ideas in Implement non-textural graphic eye-candy #173,
  • Avara is a strange beast compared to other 3D games--even storing these properties redundantly per vertex is actually cheaper than how similar features are implemented in other games with textures, where each pixel per albedo, normal map, etc. texture is 32-bits!

@rherriman rherriman merged commit 6be0be0 into avaraline:main Dec 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant