mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 13:05:55 +00:00
Lava and water shaders
This commit is contained in:
parent
6777cb1447
commit
ddde409dbf
4 changed files with 57 additions and 26 deletions
|
|
@ -3,8 +3,6 @@ class_name AcidArea
|
|||
extends Area3D
|
||||
|
||||
const _ACID_SHADER := preload("res://Shaders/Acid.gdshader")
|
||||
# Replace this path with your actual noise texture resource once you have one saved on disk.
|
||||
# A NoiseTexture2D saved as a .tres file works well here.
|
||||
const _NOISE_TEX_PATH := "res://Shaders/acid_noise.tres"
|
||||
|
||||
func _init() -> void:
|
||||
|
|
@ -24,12 +22,10 @@ func _apply_shader_to_mesh(mesh_instance: MeshInstance3D, noise_tex: NoiseTextur
|
|||
if surface_count == 0 and mesh_instance.mesh != null:
|
||||
surface_count = mesh_instance.mesh.get_surface_count()
|
||||
for i in range(surface_count):
|
||||
# Grab the texture func_godot baked into the surface before we replace the material
|
||||
var existing_tex: Texture2D = null
|
||||
var existing_mat := mesh_instance.mesh.surface_get_material(i) as BaseMaterial3D
|
||||
if existing_mat != null:
|
||||
existing_tex = existing_mat.albedo_texture
|
||||
|
||||
var mat := ShaderMaterial.new()
|
||||
mat.shader = _ACID_SHADER
|
||||
if existing_tex != null:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue