Jump to content

Search the Community

Showing results for tags 'uniforms'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 5 results

  1. I've discovered that this playground doesn't run on iPhone 6+ https://playground.babylonjs.com/#BDG7ME#28 I get this error: [Error] WebGL: ERROR: too many uniforms compileShader i (babylon.js:4:31855) t (babylon.js:4:31705) createShaderProgram (babylon.js:6:18019) _prepareEffect (babylon.js:1:10164) (anonymous function) (babylon.js:1:4037) promiseReactionJob [Error] BJS - [14:06:47]: Unable to compile effect: _ErrorEnabled (babylon.js:4:8244) _prepareEffect (babylon.js:1:10998) (anonymous function) (babylon.js:1:4037) promiseReactionJob [Error] BJS - [14:06:47]: Uniforms: world, view, viewProjection, vEyePosition, vLightsType, vAmbientColor, vDiffuseColor, vSpecularColor, vEmissiveColor, vFogInfos, vFogColor, pointSize, vDiffuseInfos, vAmbientInfos, vOpacityInfos, vReflectionInfos, vEmissiveInfos, vSpecularInfos, vBumpInfos, vLightmapInfos, vRefractionInfos, mBones, vClipPlane, diffuseMatrix, ambientMatrix, opacityMatrix, reflectionMatrix, emissiveMatrix, specularMatrix, bumpMatrix, normalMatrix, lightmapMatrix, refractionMatrix, diffuseLeftColor, diffuseRightColor, opacityParts, reflectionLeftColor, reflectionRightColor, emissiveLeftColor, emissiveRightColor, refractionLeftColor, refractionRightColor, vReflectionPosition, vReflectionSize, logarithmicDepthConstant, vTangentSpaceParams, vLightData0, vLightDiffuse0, vLightSpecular0, vLightDirection0, vLightGround0, lightMatrix0, shadowsInfo0, depthValues0, morphTargetInfluences, diffuseSampler, ambientSampler, opacitySampler, reflectionCubeSampler, reflection2DSampler, emissiveSampler, specularSampler, bumpSampler, lightmapSampler, refractionCubeSampler, refraction2DSampler, shadowSampler0 _ErrorEnabled (babylon.js:4:8244) _prepareEffect (babylon.js:1:11041) (anonymous function) (babylon.js:1:4037) promiseReactionJob I think the max number of uniforms on iPhone 6+ is 64. My mesh has a skeleton but there's only 24 bones. Are the 3 morph targets pushing it over the edge? Is there something I can do to reduce uniforms?
  2. What are all the babylon possible shader attributes and uniforms: // Attributes attribute vec3 position; attribute vec3 normal; attribute vec2 uv; // Uniforms uniform mat4 worldViewProjection; i assume they will all be equiv to some webgl attribute (if you had to do in strait webgl). So i assume: position = gl_Vertex -> To vec3 normal = gl_Normal -> To vec3 uv = gl_MultiTexCoord0 - To vec2 and worldViewProjection = gl_ProjectionMatrix * gl_ModelViewMatrix and so on... What are all the other possible attributes and uniforms, and most importantly what do they equal in regular GLSL. A... I just would to really understand where each attribute and uniform comes from. B... I am trying to make a 'Universal Unity Babylon GLSL Shader Template' for use directly in the Unity for creating Babylon shaders. Minimal Example Shader For Unity: Shader "BabylonJS/Sample basic shader" { // defines the name of the shader SubShader { // Unity chooses the subshader that fits the GPU best Pass { // some shaders require multiple passes GLSLPROGRAM // here begins the part in Unity's GLSL #ifdef VERTEX // here begins the vertex shader void main() // all vertex shaders define a main() function { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; // this line transforms the predefined attribute // gl_Vertex of type vec4 with the predefined // uniform gl_ModelViewProjectionMatrix of type mat4 // and stores the result in the predefined output // variable gl_Position of type vec4. } #endif // here ends the definition of the vertex shader #ifdef FRAGMENT // here begins the fragment shader void main() // all fragment shaders define a main() function { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); // this fragment shader just sets the output color // to opaque red (red = 1.0, green = 0.0, blue = 0.0, // alpha = 1.0) } #endif // here ends the definition of the fragment shader ENDGLSL // here ends the part in GLSL } } } My intent was to parse the shader text blocks for the vertex and fragment sections during export. Then do some kind 'key text replace' in the vertex part that reads all the attributes and uniforms replace with babylon.js equivalent at export. I would also love to base64 encode this vertex and fragment program right in the ShaderMaterial section of the .babylon son file. I posted a topic on this, hopefully others can see the benefits as well. Anyways... Any info on all the BUILT-IN attributes and uniforms that babylon.js exposes (and how they are calculated so i can duplicate that calculation when running in unity editor) THANK YOU VERY MUCH
  3. I really need help understanding the GLSL versions of the provided BABYLON uniforms. I have seen them called so many different names depending on who's docs your reading. The ONLY ONE I know for sure is in babylon.js when you say 'worldViewProjection' that is the GLSL computation of 'gl_ProjectionMatrix * gl_ModelViewMatrix' or you can use the built-in shortcut 'gl_ModelViewProjectionMatrix' I need someone who know BABYLON JS GLSL Stuff to PLEASE PLEASE PLEASE... Tell me what the others equal in GLSL terms: view = gl_??? projection = gl_??? (maybe its: gl_ProjectionMatrix ) viewProjection = gl_??? * gl_??? world = gl_??? worldView = gl_??? worldViewProjection = 'gl_ProjectionMatrix * gl_ModelViewMatrix' or can be simplified as just 'gl_ModelViewProjectionMatrix' I am sorry i don't know the GLSL stuff, but if i can someone who does to simple fill out the five 'gl_???' place holders above... Ill be your friend for life Note: I and trying yo create a block of code that will run in both unity using GLSL stuff and BABYLON JS using native uniforms. By Babylon Macros: //BABYLON-VERTEX-MACROS-START attribute vec3 position; vec4 GL_POSITION_ATTRIBUTE() { return vec4(position, 1.0); } attribute vec3 normal; vec3 GL_NORMAL_ATTRIBUTE() { return normal; } attribute vec2 uv; vec2 GL_UV_ATTRIBUTE() { return uv; } attribute vec2 uv2; vec2 GL_UV2_ATTRIBUTE() { return uv2; } attribute vec2 uv3; vec2 GL_UV3_ATTRIBUTE() { return uv3; } attribute vec2 uv4; vec2 GL_UV4_ATTRIBUTE() { return uv4; } attribute vec2 uv5; vec2 GL_UV5_ATTRIBUTE() { return uv5; } attribute vec2 uv6; vec2 GL_UV6_ATTRIBUTE() { return uv6; } attribute vec4 color; vec4 GL_COLOR_ATTRIBUTE() { return color; } uniform mat4 view; mat4 GL_VIEW_UNIFORM() { return view; } uniform mat4 projection; mat4 GL_PROJECTION_UNIFORM() { return projection; } uniform mat4 viewProjection; mat4 GL_VIEWPROJECTION_UNIFORM() { return viewProjection; } uniform mat4 world; mat4 GL_WORLD_UNIFORM() { return world; } uniform mat4 worldView; mat4 GL_WORLDVIEW_UNIFORM() { return worldView; } uniform mat4 worldViewProjection; mat4 GL_WORLDVIEWPROJECTION_UNIFORM() { return worldViewProjection; } //BABYLON-VERTEX-MACROS-END My GLSL Equivalent Macros (as you can see I still need the gl_??? parts): //BABYLON-VERTEX-MACROS-START vec4 GL_POSITION_ATTRIBUTE() { return gl_Vertex; } vec3 GL_NORMAL_ATTRIBUTE() { return gl_Normal; } vec2 GL_UV_ATTRIBUTE() { return vec2(gl_MultiTexCoord0.xy); } vec2 GL_UV2_ATTRIBUTE() { return vec2(gl_MultiTexCoord1.xy); } vec2 GL_UV3_ATTRIBUTE() { return vec2(gl_MultiTexCoord2.xy); } vec2 GL_UV4_ATTRIBUTE() { return vec2(gl_MultiTexCoord3.xy); } vec2 GL_UV5_ATTRIBUTE() { return vec2(gl_MultiTexCoord4.xy); } vec2 GL_UV6_ATTRIBUTE() { return vec2(gl_MultiTexCoord5.xy); } vec4 GL_COLOR_ATTRIBUTE() { return gl_Color; } mat4 GL_VIEW_UNIFORM() { return gl_???; } mat4 GL_PROJECTION_UNIFORM() { return gl_??? ; } mat4 GL_VIEWPROJECTION_UNIFORM() { return gl_???; } mat4 GL_WORLD_UNIFORM() { return gl_???; } mat4 GL_WORLDVIEW_UNIFORM() { return gl_???; } mat4 GL_WORLDVIEWPROJECTION_UNIFORM() { return gl_ModelViewProjectionMatrix; } //BABYLON-VERTEX-MACROS-END I know some GLSL guy look at that GLSL BLOCK and see those gl_??? and know exactly with those be... no problem for him. If you are that guy, please help me
  4. hi.. following link is example http://jsfiddle.net/gbear/n0kzcjyu/20/ i set mark of uniformsd it has like following code but it look like not have any value in fragmentshader. if change 'float dist = distance(start, makr) to following code, shader is good can you tell me where is wrong?
  5. I would like to create an array of colors in my shader code. What is the correct way to do this. Apparently you can't code this directly into the shader, but doing it via uniforms is supposed to work. The following code I have returns this error message in the console: Pixi.js Shader Warning: Unknown uniform type: undefined This is my shader code: precision mediump float; uniform vec3 cols[127]; uniform float screenHeight; uniform float screenWidth; void main(){ //Not implemented yet gl_FragColor =vec4(1.0,1.0,1.0,1.0); } And my JS code which is supposed to set up the uniforms: uniforms.screenHeight = {type:"f",value:dims.width}; uniforms.screenWidth = {type:"f",value:dims.height}; var cols =["0B5624", /* 125 more colors*/ "5B5A57"]; var mycols = [cols.length] ; for(var i=0; i<cols.length; i++){ mycols[i] = {type: "v3v", value:[(hexToR(cols[i])/256).toFixed(2), (hexToG(cols[i])/256).toFixed(2), (hexToB(cols[i])/256).toFixed(2)]}; } uniforms.cols = mycols; shady = new PIXI.AbstractFilter('',myShaderCode,uniforms);
×
×
  • Create New...