Grass Update
This commit is contained in:
parent
81ba5b2b40
commit
82faa6c117
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d26yo7jsrxtws"
|
||||
path.s3tc="res://.godot/imported/grass-albedo.jpg-c84cfed4e689cec916b830b5e61c6fc2.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rokojori_action_library/Assets/Procedural/Grass/grass-albedo.jpg"
|
||||
dest_files=["res://.godot/imported/grass-albedo.jpg-c84cfed4e689cec916b830b5e61c6fc2.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bq7d1ml585fxg"
|
||||
path.s3tc="res://.godot/imported/grass-normal.jpg-161cf607f42dce5cf9be332a6b828c4c.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rokojori_action_library/Assets/Procedural/Grass/grass-normal.jpg"
|
||||
dest_files=["res://.godot/imported/grass-normal.jpg-161cf607f42dce5cf9be332a6b828c4c.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=1
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=1
|
||||
roughness/src_normal="res://addons/rokojori_action_library/Runtime/Procedural/Assets/Grass/grass-normal.jpg"
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b4qprmwr2fmno"
|
||||
path.s3tc="res://.godot/imported/grass-orm.jpg-c21643a740d42c09c2f89b7bf2e82eda.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rokojori_action_library/Assets/Procedural/Grass/grass-orm.jpg"
|
||||
dest_files=["res://.godot/imported/grass-orm.jpg-c21643a740d42c09c2f89b7bf2e82eda.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
|
@ -407,12 +407,17 @@ namespace Rokojori
|
|||
return bladeSegments * 2 * ComputeNumBlades();
|
||||
}
|
||||
|
||||
public bool isCreating = false;
|
||||
|
||||
public async Task CreatePatch( string patchName = null )
|
||||
{
|
||||
RJLog.Log( "Create Patch:", patchName );
|
||||
isCreating = true;
|
||||
|
||||
// RJLog.Log( "Create Patch:", patchName );
|
||||
|
||||
if ( blades == 0 && bladesX == 0 && bladesZ == 0)
|
||||
{
|
||||
isCreating = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -434,8 +439,7 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
|
||||
this.DestroyChildren();
|
||||
this.output = this.CreateChild<MeshInstance3D>( patchName );
|
||||
this.output = this.GetOrCreateChild<MeshInstance3D>( patchName );
|
||||
|
||||
|
||||
|
||||
|
@ -526,6 +530,8 @@ namespace Rokojori
|
|||
currentLODLevel = cachedCurrentLODLevel;
|
||||
}
|
||||
|
||||
isCreating = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
namespace Rokojori
|
||||
{
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class UpdateGrassPatch:Action
|
||||
{
|
||||
[Export]
|
||||
public GrassPatch grassPatch;
|
||||
|
||||
protected override void _OnTrigger()
|
||||
{
|
||||
|
||||
if ( grassPatch == null || grassPatch.isCreating )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
grassPatch.CreatePatch( "Grass Patch" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
uid://bdjcmayust2t0
|
|
@ -13,6 +13,8 @@ uniform float hslVariationUVScale;
|
|||
uniform vec2 hslVariationUVOffset;
|
||||
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
|
||||
varying vec3 albedoColor;
|
||||
uniform float albedoToBacklight: hint_range(0.0, 1.0);
|
||||
uniform vec3 backlight: source_color;
|
||||
|
||||
uniform float roughness : hint_range(0.0, 1.0);
|
||||
uniform sampler2D texture_metallic : hint_default_white, filter_linear_mipmap, repeat_enable;
|
||||
|
@ -61,6 +63,7 @@ void vertex()
|
|||
albedoHSL = clamp( albedoHSL, vec3( 0,0,0 ), vec3( 1,1,1 ) );
|
||||
albedoColor = mix( albedo.rgb, HSLtoRGB( albedoHSL ), hslVariation.w );
|
||||
|
||||
|
||||
|
||||
|
||||
if ( windEnabled )
|
||||
|
@ -86,7 +89,8 @@ void fragment()
|
|||
|
||||
vec4 albedo_tex = texture(texture_albedo, base_uv);
|
||||
ALBEDO = albedoColor * albedo_tex.rgb;
|
||||
|
||||
BACKLIGHT = ALBEDO * albedoToBacklight + backlight;
|
||||
|
||||
|
||||
float metallic_tex = dot(texture(texture_metallic, base_uv), metallic_texture_channel);
|
||||
METALLIC = metallic_tex * metallic;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 417 KiB |
|
@ -229,7 +229,7 @@ namespace Rokojori
|
|||
}
|
||||
);
|
||||
|
||||
RJLog.Log( GetTypeSlot(), customFormat, colors.Count );
|
||||
// RJLog.Log( GetTypeSlot(), customFormat, colors.Count );
|
||||
array[ (int) GetTypeSlot() ] = colors.ToArray();
|
||||
|
||||
|
||||
|
@ -1580,10 +1580,10 @@ namespace Rokojori
|
|||
if ( lodDictionary != null && lodDictionary.Count > 0 )
|
||||
{
|
||||
var keys = Lists.From( lodDictionary.Keys );
|
||||
RJLog.Log( "LODS:", keys );
|
||||
// RJLog.Log( "LODS:", keys );
|
||||
}
|
||||
|
||||
RJLog.Log( "Flags:", flags );
|
||||
// RJLog.Log( "Flags:", flags );
|
||||
arrayMesh.AddSurfaceFromArrays( type, surfaceArray, null, lodDictionary, flags );
|
||||
|
||||
if ( generateTangents )
|
||||
|
@ -1603,7 +1603,7 @@ namespace Rokojori
|
|||
return;
|
||||
}
|
||||
|
||||
RJLog.Log( "Creating mesh with LODs", vertices.Count );
|
||||
// RJLog.Log( "Creating mesh with LODs", vertices.Count );
|
||||
|
||||
var higherIndices = indices;
|
||||
var higherIndicesLength = indices.Count;
|
||||
|
|
Before Width: | Height: | Size: 13 MiB After Width: | Height: | Size: 13 MiB |
|
@ -3,7 +3,7 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c30nul6romace"
|
||||
path.s3tc="res://.godot/imported/Foliage Renderer Default Noise.png-18f32fa6cf85749d36ab7c25bf9094e5.s3tc.ctex"
|
||||
path.s3tc="res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
|
@ -11,8 +11,8 @@ metadata={
|
|||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rokojori_action_library/Runtime/Rendering/Assets/Foliage/Foliage Renderer Default Noise.png"
|
||||
dest_files=["res://.godot/imported/Foliage Renderer Default Noise.png-18f32fa6cf85749d36ab7c25bf9094e5.s3tc.ctex"]
|
||||
source_file="res://addons/rokojori_action_library/Runtime/Procedural/Noise/RGB 3D Noise.png"
|
||||
dest_files=["res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
|
@ -27,13 +27,13 @@ namespace Rokojori
|
|||
{
|
||||
|
||||
[Export]
|
||||
public float cellSize;
|
||||
public float cellSize = 1.0f;
|
||||
|
||||
[Export]
|
||||
public float visibilityRange;
|
||||
public float visibilityRange = 50f;
|
||||
|
||||
[Export]
|
||||
public float visibilityFadeRelative = 0.1f;
|
||||
public float visibilityFadeRelative = 0.2f;
|
||||
|
||||
[Export]
|
||||
public float visibilityFadeAbsolute = 0f;
|
||||
|
@ -79,15 +79,15 @@ namespace Rokojori
|
|||
|
||||
|
||||
[Export(PropertyHint.Range,"0,1")]
|
||||
public float occupancyVarianceAmount = 1f;
|
||||
public float occupancyVarianceAmount = 0f;
|
||||
[Export(PropertyHint.Range,"0,50")]
|
||||
public float occupancyVariancePower = 0f;
|
||||
public float occupancyVariancePower = 1f;
|
||||
|
||||
[Export(PropertyHint.Range,"0,1")]
|
||||
public float occupancyTreshold = 0f;
|
||||
public float occupancyTreshold = 0.5f;
|
||||
|
||||
[Export]
|
||||
public float occupancyHideOffset = -3f;
|
||||
public float occupancyHideOffset = -2f;
|
||||
[Export]
|
||||
public float occupancyHideScale = 0.1f;
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ namespace Rokojori
|
|||
|
||||
[Tool]
|
||||
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Scatterer.svg") ]
|
||||
public partial class FoliageRenderer:Node
|
||||
public partial class FoliageRenderer:Node3D
|
||||
{
|
||||
[Export]
|
||||
public FoliageData[] foliage;
|
||||
public FoliageData[] foliage = [];
|
||||
|
||||
List<FoliageRenderLayer> renderLayers = [];
|
||||
|
||||
|
@ -59,11 +59,13 @@ namespace Rokojori
|
|||
{
|
||||
_assignedCamera = null;
|
||||
|
||||
if ( ! processLayers )
|
||||
if ( ! processLayers || foliage == null || foliage.Length == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( updateLayers || foliage.Length != renderLayers.Count )
|
||||
{
|
||||
updateLayers = false;
|
||||
|
@ -90,7 +92,16 @@ namespace Rokojori
|
|||
|
||||
// this.LogInfo( "Processing", renderLayers.Count );
|
||||
|
||||
renderLayers.ForEach( r => r.Update( delta ) );
|
||||
renderLayers.ForEach( r =>
|
||||
{
|
||||
if ( r == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
r.Update( delta );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
namespace Rokojori
|
||||
{
|
||||
/** <summary for="class PackedSceneFoliageData">
|
||||
|
||||
<title>
|
||||
A node to render foliage.
|
||||
</title>
|
||||
|
||||
<description>
|
||||
The GrassPatch has various settings to create a different styles of grass.
|
||||
It allows to change the shapes of the blades, their number and distribution, their triangle count,
|
||||
rotation and scale, LOD levels and much more.
|
||||
|
||||
|
||||
</description>
|
||||
|
||||
</summary>
|
||||
*/
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class MeshInstanceFoliageData:FoliageData
|
||||
{
|
||||
[Export]
|
||||
public NodePath meshInstanceReference;
|
||||
|
||||
public override void Initialize( FoliageRenderLayer renderLayer )
|
||||
{
|
||||
var particles = renderLayer.renderer.CreateChild<GpuParticles3D>();
|
||||
|
||||
renderLayer.gpuParticles3D = particles;
|
||||
|
||||
var processMaterial = new GPUFoliageShaderMaterial();
|
||||
particles.ProcessMaterial = processMaterial;
|
||||
particles.Lifetime = 0.01f;
|
||||
particles.Explosiveness = 1f;
|
||||
particles.FixedFps = 0;
|
||||
particles.Interpolate = false;
|
||||
particles.FractDelta = false;
|
||||
|
||||
particles.CustomAabb = Box3.WithSize( 10000 );
|
||||
|
||||
processMaterial.positionVariance.Set( renderLayer.renderer.noise );
|
||||
processMaterial.rotationVariance.Set( renderLayer.renderer.noise );
|
||||
processMaterial.scaleVariance.Set( renderLayer.renderer.noise );
|
||||
processMaterial.occupancyVariance.Set( renderLayer.renderer.noise );
|
||||
|
||||
renderLayer.gpuFoliageShaderMaterial = processMaterial;
|
||||
|
||||
var meshInstance = renderLayer.renderer.GetNode( meshInstanceReference ) as MeshInstance3D;
|
||||
|
||||
particles.DrawPasses = 1;
|
||||
particles.DrawPass1 = meshInstance.Mesh;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
uid://c5ia5ogtg1725
|
|
@ -0,0 +1 @@
|
|||
uid://cnhv0vto6bqbl
|
|
@ -0,0 +1 @@
|
|||
uid://bq06acd0niix7
|
|
@ -22,7 +22,7 @@ namespace Rokojori.Tools
|
|||
protected override void _OnTrigger()
|
||||
{
|
||||
#if TOOLS
|
||||
GLTFExport.Save( root, path );
|
||||
GLTFExport.Save( root, ProjectSettings.GlobalizePath( path ) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue