is there a way to do smooth shading of single node?

Post Reply
Aeodar
Member
Posts: 18
Joined: Sun Feb 19, 2023 22:11

is there a way to do smooth shading of single node?

by Aeodar » Post

The cube on the left has flat shading and the cube on the right has smooth shading:

Image

is there any way to create a node/block that has smooth shading? or is there some way to enable smooth shading for every block?

i know there is a smooth shading option but i think it does something different from what im asking?

i made a custom node whos normals are in the attached image

the normals face diagonally outward so i would expect the edges to appear round.

but even with smooth shading enabled you can still see the flat shading in the attached game image.

thanks!
Attachments
Capture2.PNG
Capture2.PNG (40.8 KiB) Viewed 657 times
Capture.PNG
Capture.PNG (298.35 KiB) Viewed 658 times

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

Re: is there a way to do smooth shading of single node?

by Skamiz Kazzarch » Post

You could try using the 'mesh' drawtype:
https://github.com/minetest/minetest/bl ... .txt#L1232

Code: Select all

* `mesh`
    * Uses models for nodes.
    * Tiles should hold model materials textures.
    * Only static meshes are implemented.
But I am honestly not sure if Minetest supports this kind of smooth shading.

Aeodar
Member
Posts: 18
Joined: Sun Feb 19, 2023 22:11

Re: is there a way to do smooth shading of single node?

by Aeodar » Post

i forgot to mention i am using the mesh draw type

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

Re: is there a way to do smooth shading of single node?

by Skamiz Kazzarch » Post

Whelp that was all the advice I had on the topic.
I also don't recall ever seeing the effect you are going for in Minetest. So chances are that it just straight up isn't possible.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: is there a way to do smooth shading of single node?

by sirrobzeroone » Post

Similar I've played around a bit with the blender and mesh nodes and seen what the engine supports etc and Iikewise never been able to replicate that type of look. I even found the bump/normal maps to be of limited use to give the nodes a different look but you could give that a try - been 4+ years since I played with bump/normal and I think it was removed not sure as I stopped following that issue.

I would say be cautious of using mesh nodes for a whole map gen see my question here and explanation from Krock/SmallJoker
viewtopic.php?t=23262

Not sure this helps much though.....

User avatar
Desour
Member
Posts: 1469
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: is there a way to do smooth shading of single node?

by Desour » Post

.obj has smoothing groups (see <https://en.wikipedia.org/wiki/Wavefront ... _materials>). Idk if minetest supports this.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
Blockhead
Member
Posts: 1623
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: is there a way to do smooth shading of single node?

by Blockhead » Post

Smooth shading data should be exported properly by Blender and usable by Minetest if you have a mesh node. If not, it seems like a bug.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Aeodar
Member
Posts: 18
Joined: Sun Feb 19, 2023 22:11

Re: is there a way to do smooth shading of single node?

by Aeodar » Post

So there is a function in mesh.cpp called applyFacesShading
I changed it to this and it removed the shading

Code: Select all

if (normal.Y < 0)
	applyShadeFactor(color, 1.000000 * x2 + 1.0f * y2 + 1.000000 * z2);
else if ((x2 > 1e-3) || (z2 > 1e-3))
	applyShadeFactor(color, 1.000000 * x2 + 1.000000f * y2 + 1.000000 * z2);
not sure why this function is manually shading faces...

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests