Skip to content

Convert Noise shader to version 1.4.0 #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions material/noise/example/noise.fp
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
varying mediump vec2 var_texcoord0;
uniform lowp vec4 time;
#version 140

in mediump vec2 var_texcoord0;

uniform fs_uniforms
{
mediump vec4 time;
};

out mediump vec4 out_fragColor;

// noise shader from https://www.shadertoy.com/view/XXBcDz

Expand Down Expand Up @@ -42,6 +50,6 @@ float fbm( vec2 p )
void main()
{
float n = fbm(var_texcoord0.xy);
gl_FragColor = vec4(n, n, n, 1.0);
out_fragColor = vec4(n, n, n, 1.0);
}

8 changes: 0 additions & 8 deletions material/noise/example/noise.material
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@ vertex_constants {
name: "mtx_worldview"
type: CONSTANT_TYPE_WORLDVIEW
}
vertex_constants {
name: "mtx_view"
type: CONSTANT_TYPE_VIEW
}
vertex_constants {
name: "mtx_proj"
type: CONSTANT_TYPE_PROJECTION
}
vertex_constants {
name: "mtx_normal"
type: CONSTANT_TYPE_NORMAL
}
fragment_constants {
name: "time"
type: CONSTANT_TYPE_USER
Expand Down
29 changes: 13 additions & 16 deletions material/noise/example/noise.vp
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
#version 140

// Positions can be world or local space, since world and normal
// matrices are identity for world vertex space materials.
// If world vertex space is selected, you can remove the
// normal matrix multiplication for optimal performance.
in highp vec4 position;
in mediump vec2 texcoord0;
in mediump vec3 normal;

attribute highp vec4 position;
attribute mediump vec2 texcoord0;
attribute mediump vec3 normal;

uniform mediump mat4 mtx_worldview;
uniform mediump mat4 mtx_view;
uniform mediump mat4 mtx_proj;
uniform mediump mat4 mtx_normal;
uniform vp_uniforms
{
mediump mat4 mtx_worldview;
mediump mat4 mtx_proj;
};

varying highp vec4 var_position;
varying mediump vec3 var_normal;
varying mediump vec2 var_texcoord0;
out highp vec4 var_position;
out mediump vec2 var_texcoord0;

void main()
{
vec4 p = mtx_worldview * vec4(position.xyz, 1.0);
highp vec4 p = mtx_worldview * vec4(position.xyz, 1.0);
var_texcoord0 = texcoord0;

gl_Position = mtx_proj * p;
}

2 changes: 1 addition & 1 deletion material/noise/game.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
title = Defold-examples
title = material_noise
version = 0.1

[bootstrap]
Expand Down