Comments (6)
- missing some qualifier in function parameter,such as 'inout':
float test(const in a, inout b, out c){}
from engine.
- missing some qualifier in function parameter,such as 'inout':
float test(const in a, inout b, out c){}
qualifiers such as in
/out
/inout
should be in front of parameter type, be like:
float test(in float a, inout float b, out vec2 c){}
from engine.
i write a simple demo, see issue below:
/**
* @title ShaderLab Test
* @category Material
*/
import { Camera, Logger, Material, MeshRenderer, PrimitiveMesh, Shader, WebGLEngine } from "@galacean/engine";
import { ShaderLab } from "@galacean/engine-shader-lab";
Logger.enable();
const shaderLab = new ShaderLab();
const FurShaderSource = `Shader "Fur" {
SubShader "Default" {
// @issue: renderState outside
// BlendState blendState {
// Enabled = true;
// SourceColorBlendFactor = BlendFactor.SourceAlpha;
// DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
// SourceAlphaBlendFactor = BlendFactor.One;
// DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
// }
// BlendState = blendState;
// RenderQueueType = RenderQueueType.Transparent;
mat4 renderer_MVPMat;
mat4 renderer_ModelMat;
mat4 renderer_NormalMat;
vec3 camera_Position;
sampler2D _MainTex;
sampler2D _LayerTex;
sampler2D _NoiseTex;
vec3 _Gravity;
float _GravityIntensity;
float _EdgeFade;
float _Cutoff;
float _CutoffEnd;
float _FurLength;
struct a2v {
vec4 POSITION;
}
// float issue_qualifier(inout float a){
// return 1.0;
// }
v2f issue_v2f(a2v v){
v2f o;
gl_Position = renderer_MVPMat * v.POSITION;
return o;
}
Pass "0" {
v2f vert(a2v v) {
// v2f o;
// gl_Position = renderer_MVPMat * v.POSITION;
// @issue:qualifier
// issue_qualifier(1.0);
// @issue: v2f outside
return issue_v2f(v);
// return o;
}
void frag(v2f i) {
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
VertexShader = vert;
FragmentShader = frag;
}
}
}`;
Logger.enable();
WebGLEngine.create({ canvas: "canvas", shaderLab }).then((engine) => {
engine.canvas.resizeByClientSize();
// test Shader
const shader = Shader.create(FurShaderSource);
const scene = engine.sceneManager.activeScene;
const rootEntity = scene.createRootEntity();
// camera
const cameraEntity = rootEntity.createChild("cameraNode");
cameraEntity.transform.setPosition(0, 0, 5);
cameraEntity.addComponent(Camera);
const triangle = rootEntity.createChild("plane");
const renderer = triangle.addComponent(MeshRenderer);
renderer.mesh = PrimitiveMesh.createSphere(engine, 2, 64);
const material = new Material(engine, shader);
renderer.setMaterial(material);
engine.run();
});
from engine.
multi pass shader refs to: https://github.com/chenyong2github/ExtendStandard/blob/master/Assets/Shaders/Unlit_Fur.shader
from engine.
add playground multi-pass test case: galacean/galacean.github.io#969
from engine.
- can't write uniform outside Multi pass
fixed by #2018
from engine.
Related Issues (20)
- Refactor pbr shader api with ShaderLab HOT 1
- Support Post Process Pipeline
- Particle Renderer add Limit Velocity over Lifetime Module
- MeshOpt normal precision error
- Animation keyframe support weighted Tangent
- AnimationClip support add to entity by drag
- The this of script's callback is not right
- Component parser support entity's reference
- H5页面上部署多个游戏,当不同游戏相互切换时伴随engine的重复创建,多次切换会出现白屏问题 HOT 1
- DepthOnly Pass need support alpha Cutoff
- ParticleCompositeCurve Curve and TwoCurves Mode not as expected
- shaderlab macro function bug
- ShaderLab macro bug
- The code in the ShaderLab macro cannot determine whether it is a vertex or a fragment. HOT 2
- ShaderLab code timing issues HOT 1
- Extact "mattered" macro list from shader source
- ProjectLoader support progress
- Shaderlab support include code outside the pass
- SubPromise will be blocked by GLTFLoader If the assetURL is error
- A model with multiple SkinnedMeshRenderers, when playing animations, only the last one's weights are updated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from engine.