New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firelike drawtype: Simplify and improve #3171
Conversation
This is only mesh making, so shouldn't help with the FPS problem at all. |
I don't know, can irrlicht be ordered to only render certain faces when looking at them from certain angles? could the two center faces are added again and only rendered when you look at them from higher degrees than e.g. 45°? |
Hm, it is a bit ugly, maybe we could tilt the 4 flames in more.
I think that would be visually annoying, it's a messy and overcomplex method too. |
👎 Param2 is not and should not be reserved for rotation. If a subgame does that in order to have higher speed (which is a quite small win compared that you sacrifice the whole param2 field for facedir only), fine then they should only use it for that. The only reason why removing param2 here might be acceptable, is that it isn't used by mods, but there is totally no reason why it is "unusable" as you claim. |
Yes i agree. But it will help at mesh creation. To be clear, the rotation br param2 i removed here is the fine-step rotation added to plantlike by RBA, not facedir. It added complexity to the code which would perhaps never be usable because firelike needs to be orientated to the grid. I might try tilting the 4 textures in more, by 22.5 degrees. |
You claimed that it is not useable because it causes wrong facedir orientations for neighbouring nodes, no? |
Remove 2 central diagonal textures Remove unusable param2 fine rotation that would break orientation to neighbouring nodes Replace top 4 textures with 1, spaced by 1/16 node The new total of 5 fixes top textures missing in certain circumstances Tilt textures in by 22.5 (90/4) degrees instead of 10 Use floats, not ints, for vOffset and hOffset, and tune these Fix code style issues and long lines
I meant i removed the ' + n.param2 * 2' from for example: Anyway, i agree with you about my commit looking ugly from above, so have tilted the textures in more, first post updated. |
Heh after all that i've changed my mind. Tilting the side flames in more may improve density, but these are then too far away from neighbour nodes. Complex as it is the 6 lower flames seem to be needed. I also realsed the top 4 flames work okay as they are due to the logic. I'll open a new PR with just the code cleanup and simplifications, removal of fine-rotation, and slightly adjust the angles used to 11.25 and 22.5 degrees. |
Remove 2 central diagonal textures
Remove unusable param2 fine rotation that would break
orientation to neighbouring nodes
Replace top 4 textures with 1, spaced by 1/16 node
The new total of 5 fixes top textures missing in certain
circumstances
Tilt textures in by 22.5 (90/4) degrees instead of 10
Use floats, not ints, for vOffset and hOffset, and tune these
Fix code style issues and long lines
Current firelike has a problem, it uses 10 textures within a limit of 6. The lower 4 side flames override the top 4 flames (the burning underside of the node above). Depending on which of the lower side flames are used some of the top textures are missing. Also, using 4 flames for the single node surface above is over-complex.
With this commit:
^ On it's own has a pyramid campfire look.
^ Textures are tilted in more for more density when seen from above.
This commit removes the 2 central diagonal flames and uses a single top flame, for a new total of 5 textures, because this is less than the limit of 6 these are all independant so none will be missing in certain circumstances.
The top texture is spaced by a single 16px texture pixel from the node above:
The side flames are tilted in more (from 10 to 22.5 degrees) to help with visual flame density. I was considering what angles are suitable in Minetest, we have 90 and 45 degree angles which are 360 / 2^n, repeated division of 360 by 2, which results in 22.5 degrees.
I removed the fine-step rotation by param2 (a feature recently added to plantlike by RealBadAngel), this would be unusable because the flames of firelike need to be orientated to surrounding nodes.
'int's were being used for vOffset and hOffset, i changed these to 'float's for the necessary accuracy in positioning the textures to meet the lower edges.
Firelike code is now more lightweight during mesh generation, the fewer textures will help with the significant FPS drop of a large fire which players have reported.