Fixing Normals for Heightmap Terrain in Godot 4 - the Easy Way

Поділитися
Вставка
  • Опубліковано 6 вер 2024
  • Follow-up to the 'wandering' terrain video. Quick and easy way to recalculate normals for a heightmap terrain make with vertex shader displacement. This one relies on normal maps either made in Godot (via 'As Normal Map' setting on a procedural noise texture) or imported from a 3rd party terrain generator.
    Special thanks to ‪@wojtek_pe‬ and ‪@williamgodwin5582‬ for putting up with my moaning on twitter.
    Btw, follow me on twitter (devmar).

КОМЕНТАРІ • 31

  • @dbatdev
    @dbatdev 2 роки тому +10

    Such helpful info - well timed for me. I can't wait to see how you managed the collider mesh. Thanks for your vids.

  • @unfa00
    @unfa00 2 роки тому +6

    Oh dear, being able to use shader code inside the Visual Shader editor is the best of both worlds.

  • @simonleonard5431
    @simonleonard5431 Рік тому

    According to one view of the UA-cam algorithm I didn't subscribe and I didn't like, but in reality I only viewed this separately on my phone to like/sub because I'm heading out of internet for a bit, so I'm grabbing useful stuff. This one is definitely useful. Any trawlers snatching and not engaging, subscribe!! Good for you, good for the channel.

  • @nsrosenqvist
    @nsrosenqvist 2 роки тому +7

    I love how you make your videos, what tools do you use to record text as you type or when you draw? Do you just record your screen while you edit a document and key the background?

    • @actualdevmar
      @actualdevmar  2 роки тому +3

      I record VO first and then play it and record the screen. I draw in Photoshop, type in notes. I put it all together in Premiere.

    • @nsrosenqvist
      @nsrosenqvist 2 роки тому +2

      @@actualdevmar genius! so simple, yet a great personal touch

  • @diegohiroshiysusvideos2909
    @diegohiroshiysusvideos2909 2 роки тому +1

    Amazing feature from Godot 4. Your game looks super chido y profesional.

  • @rusnakandrey
    @rusnakandrey 2 роки тому +2

    The Z-axis invert in this case inverts the green channel of the normal map, converting OpenGL normals to DirectX or vice versa.

    • @actualdevmar
      @actualdevmar  2 роки тому

      yea I figured that out after posting the vid

  • @pixezy8962
    @pixezy8962 Рік тому

    Useful information about normals

  • @ZylannMP3
    @ZylannMP3 2 роки тому +1

    I had a "normal_basis" in order to support rotation and non-uniform scaling of the terrain

  • @sean7221
    @sean7221 2 роки тому +3

    Devmar, do you find with every new alpha of Godot that it gets easier or less frustrating. I would love to hear your thoughts on how 4.0 is progressing.
    You're currently the only developer using 4.0 who is most skilled with 3D I have found

    • @actualdevmar
      @actualdevmar  2 роки тому +3

      There are way more skilled devs out there but I appreciate you saying this:). To your question, it's honestly becoming increasingly frustrating. Seems like from one alpha to another the engine gets insignificant updates while the major issues that keep us from beta persist. Some of those small updates improve things, while some other ones seem completely redundant, like updating function names that break your code while providing zero value. On a positive note, my project now runs with under 1000 errors. Pre-alpha, it run with 10000 errors, mostly vulkan errors that I couldn't make any sense of. So progress is definitely being made although seeing the pace I think we're in for some 50 more alphas before we graduate to beta. But you have to give it to the devs that they're building an awesome product and from my side I try and contribute as much as I can.

    • @tomtomkowski7653
      @tomtomkowski7653 2 роки тому

      @@actualdevmar I wish they rework nodes manipulation in Godot 4.
      I have no idea why in Godot manipulating objects via script is so damn overcomplicated.
      I mean position, rotation and scale - this is some kind of nightmare compared to for example Unity or UE.
      Still don't get it why this can't be just like: node (doesn't matter if this is a 3D, 2D, UI, etc) node.local.position/rotation/scale and node.global.position/rotation/scale.
      node.global.position() - getter, node.global.position(value) - setter, the same for rotation and scale, and for globals and locals.
      No idea why there is a lack of consistency with object manipulations in Godot - that makes me crazy.

  • @taguetrash
    @taguetrash Рік тому

    the generated normal map texture using this strategy has a bunch of weird "ridges" in it with the fragments in between each ridge pointing straight up, making it look like a relief map.

  • @michalfeher1177
    @michalfeher1177 Місяць тому

    Please can you tell me why you set the normal data both the normla and norml map output ? I think need to be good if you only use the normal map and connent the normal map output. But if i wrong pls can you explain why?

  • @dbatdev
    @dbatdev 2 роки тому +1

    Devmar: dying to hear about how you managed the collision mesh. I can't think of a way to get the vertex position out of a shader and into gdscript to thus alter the collision mesh at the same point. Even if you don't make a vid, could you perhaps point me in the right direction?

  • @Lunartugboat
    @Lunartugboat 2 роки тому

    Nice work

  • @RADkate
    @RADkate 2 роки тому +1

    i thought pt2 would be about vegitations, anyways iv been thinking about using a particle shader for foliage placement, i think that would classifiy it as "gpu placement", though i read you should use multimesh for this but then how do you convert textures to coordinate matrixes and dont overload the cpu, can you write shaders in godot that output matrixes ?

    • @actualdevmar
      @actualdevmar  2 роки тому +1

      I'm using a particle shader because it's easy to position the particles based on a heightmap. It' a single draw call just like with multimesh.

    • @RADkate
      @RADkate 2 роки тому +1

      @@actualdevmar yeah thats what im trying to do though how would you place colliders for trees ?

    • @actualdevmar
      @actualdevmar  2 роки тому +1

      @@RADkate oh, for bigger things that require colliders you will need to use multimesh, indeed. Should not be very complicated - sample the heightmap to get vertex positions, then set the mulitimesh instances to those positions and you have a forest.

  • @gaeson
    @gaeson 2 роки тому

    Is there any video in which you show your / a whole fragmented shader in visual nodes that works together with the vertex shader? I struggle getting them working with your snap code from the "The 'Wandering' Clipmap Terrain Technique" video.

    • @actualdevmar
      @actualdevmar  2 роки тому

      I didn't make one as there are a ton of Godot 3 visual fragment shader videos out there which are still applicable for Godot 4

    • @gaeson
      @gaeson 2 роки тому

      @@actualdevmar thank you for your reply. I seem to struggle with the basic setup of this with the clipmap moving alongside on top of the vertex shader'ed mesh.
      In your hierarchy you have a MeshInsance3D called clipmap and as its child you have the plane which gets the vertex filter. So I am assuming that the clipmap you created in blender is sitting on the clipmap node? But from what I can tell that node doesn't have a script attached.
      On top of that your plane scene seems to have a bunch of meshes as children in one of your other views. I understand that this only serves as a demonstration but I'd appreciate if you could take the time to fill in the gaps.

  • @godzil42
    @godzil42 Рік тому

    What parameters where you using for the heightmap texture and noise generator?

  • @tomtomkowski7653
    @tomtomkowski7653 2 роки тому

    3:03 - what is the name of this program?

  • @trafficface
    @trafficface 2 роки тому

    I made a mesh map from qGIS data real world, do I have to do anything special to get collision to work from this mesh? I was hoping to avoid shaders to get terrain.

    • @actualdevmar
      @actualdevmar  2 роки тому +1

      You can create a collision sibling from the mesh menu. But you should really avoid using meshes for terrain, especially large meshes.