mohsenph69 / Godot-MTerrain-plugin

A GDExtension plugin which give godot the ability to produce highly optimized Terrain for Open world games
MIT License
494 stars 25 forks source link

Terrain Next Pass not working #38

Open marciolims opened 6 months ago

marciolims commented 6 months ago

I’m having a problem with the Next Pass in MTerrain. When I create the terrain, both through the editor and via code, the Next Pass is not being applied. I can only see the Next Pass when I manually remove and add it again in the editor.

I’m using Godot version 4.2.2 stable and the plugin version is v0.13.0-alpha. I appreciate any help with this.

mohsenph69 commented 6 months ago

Hi there marciolims , I believe this can because of the saving system of MTerrainMaterial! Basically when you add Next-Pass in editor, it not got saved and therefore it will not shown in the game!

I will fix this later! but currently I give you a temporarily solution so you can make this working!

The solution is to set the next pass material in gdscript:

extends MTerrain

# Called when the node enters the scene tree for the first time.
func _ready():
    terrain_material.active_region = YOUR ACTIVE REGION
    terrain_material.set("Next Pass",YOUR NEXT PASS MATERIAL)
    terrain_material.active_region = YOUR OTHER ACTIVE REGION
    terrain_material.set("Next Pass",YOUR NEXT PASS MATERIAL)
    . . .

you can set active_region = -1, so all region get affected! or select a specific one!