Jump to content

FireMaterial Vertex shader


JCPalmer
 Share

Recommended Posts

I am using the fire material with my own textures.  I was getting a complaint about shadows with the production and the preview BJS, but it was working.  I put the preview version of fire in and the vertex shader fails over and over.

BJS - [15:08:28]: Error: ERROR: 0:102: 'uv' : undeclared identifier 
ERROR: 0:102: 'assign' :  cannot convert from 'float' to 'out highp 2-component vector of float'
ERROR: 0:124: 'x' :  field selection requires structure, vector, or interface block on left hand side 
ERROR: 0:125: 'y' :  field selection requires structure, vector, or interface block on left hand side 
ERROR: 0:126: 'x' :  field selection requires structure, vector, or interface block on left hand side 
ERROR: 0:127: 'y' :  field selection requires structure, vector, or interface block on left hand side 
ERROR: 0:128: 'x' :  field selection requires structure, vector, or interface block on left hand side 
ERROR: 0:129: 'y' :  field selection requires structure, vector, or interface block on left hand side 
BJS - [15:08:28]: Vertex shader: fire
1	#version 300 es
2	#define DIFFUSE
3	#define ALPHATEST
4	#define BonesPerMesh 20
5	#define NUM_BONE_INFLUENCERS 4
6	
7	precision highp float;
8	
9	in vec3 position;
10	#ifdef UV1
11	in vec2 uv;
12	#endif
13	#ifdef UV2
14	in vec2 uv2;
15	#endif
16	#ifdef VERTEXCOLOR
17	in vec4 color;
18	#endif
19	#if NUM_BONE_INFLUENCERS>0
20	uniform mat4 mBones[BonesPerMesh];
21	in vec4 matricesIndices;
22	in vec4 matricesWeights;
23	#if NUM_BONE_INFLUENCERS>4
24	in vec4 matricesIndicesExtra;
25	in vec4 matricesWeightsExtra;
26	#endif
27	#endif
28	
29	#ifdef INSTANCES
30	in vec4 world0;
31	in vec4 world1;
32	in vec4 world2;
33	in vec4 world3;
34	#else
35	uniform mat4 world;
36	#endif
37	uniform mat4 view;
38	uniform mat4 viewProjection;
39	#ifdef DIFFUSE
40	out vec2 vDiffuseUV;
41	#endif
42	#ifdef POINTSIZE
43	uniform float pointSize;
44	#endif
45	
46	out vec3 vPositionW;
47	#ifdef VERTEXCOLOR
48	out vec4 vColor;
49	#endif
50	#ifdef CLIPPLANE
51	uniform vec4 vClipPlane;
52	out float fClipDistance;
53	#endif
54	#ifdef FOG
55	out vec3 vFogDistance;
56	#endif
57	
58	uniform float time;
59	uniform float speed;
60	#ifdef DIFFUSE
61	out vec2 vDistortionCoords1;
62	out vec2 vDistortionCoords2;
63	out vec2 vDistortionCoords3;
64	#endif
65	void main(void) {
66	#ifdef INSTANCES
67	mat4 finalWorld=mat4(world0,world1,world2,world3);
68	#else
69	mat4 finalWorld=world;
70	#endif
71	#if NUM_BONE_INFLUENCERS>0
72	mat4 influence;
73	influence=mBones[int(matricesIndices[0])]*matricesWeights[0];
74	#if NUM_BONE_INFLUENCERS>1
75	influence+=mBones[int(matricesIndices[1])]*matricesWeights[1];
76	#endif 
77	#if NUM_BONE_INFLUENCERS>2
78	influence+=mBones[int(matricesIndices[2])]*matricesWeights[2];
79	#endif 
80	#if NUM_BONE_INFLUENCERS>3
81	influence+=mBones[int(matricesIndices[3])]*matricesWeights[3];
82	#endif 
83	#if NUM_BONE_INFLUENCERS>4
84	influence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];
85	#endif 
86	#if NUM_BONE_INFLUENCERS>5
87	influence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];
88	#endif 
89	#if NUM_BONE_INFLUENCERS>6
90	influence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];
91	#endif 
92	#if NUM_BONE_INFLUENCERS>7
93	influence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];
94	#endif 
95	finalWorld=finalWorld*influence;
96	#endif
97	gl_Position=viewProjection*finalWorld*vec4(position,1.0);
98	vec4 worldPos=finalWorld*vec4(position,1.0);
99	vPositionW=vec3(worldPos);
100	
101	#ifdef DIFFUSE
102	vDiffuseUV=uv;
103	vDiffuseUV.y-=0.2;
104	#endif
105	
106	#ifdef CLIPPLANE
107	fClipDistance=dot(worldPos,vClipPlane);
108	#endif
109	
110	#ifdef FOG
111	vFogDistance=(view*worldPos).xyz;
112	#endif
113	
114	#ifdef VERTEXCOLOR
115	vColor=color;
116	#endif
117	
118	#ifdef POINTSIZE
119	gl_PointSize=pointSize;
120	#endif
121	#ifdef DIFFUSE
122	
123	vec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;
124	vDistortionCoords1.x=uv.x;
125	vDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;
126	vDistortionCoords2.x=uv.x;
127	vDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;
128	vDistortionCoords3.x=uv.x;
129	vDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;
130	#endif
131	}

 

Link to comment
Share on other sites

I thought I was, since I Fetched / Merged yesterday, then go t this from preview.  I did again just now to be sure, it still happens. 

I should note I have 2 uses in the same scene.  One is a camp fire which works.  The 2nd, a temporary effect when a mesh appears, does not.  I did check that the mesh being applied to has UV, and it does.

Am beginning to update my scenes to 3.0.  Things are running really rough.  Will try to resolve others so this is the only problem.

Link to comment
Share on other sites

  • 5 weeks later...

@Sebavan, I found it.  UV was not defined on a child mesh.  If you look at the link above, I was setting the fire material to the mesh and all the children.  Well, the normal material for a child did not require UV.

I fixed it for my case & verified the problem by just adding a UV.  This might have been what happened back in 2.5.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...