Pryme8

Members
  • Content count

    1,100
  • Joined

  • Last visited

  • Days Won

    13

Pryme8 last won the day on January 7

Pryme8 had the most liked content!

1 Follower

About Pryme8

  • Rank
    Advanced Member
  • Birthday 04/29/1986

Profile Information

  • Gender
    Male
  • Location
    Nor. Cal
  • Interests
    Crushing it

Recent Profile Visitors

1,924 profile views
  1. Yea I want to solve this let me make a PG that can demonstrate it l and we'll start from there? I'm super busy today, but if I get a moment I'm on it.
  2. Not complaining just saying I'd love to see how someone solved it. And losing the client was nothing to worry about I have more . I would actually like to message you @RaananW if you think it's a fixable bug. It was really hard to troubleshoot because not all browsers would produce the error. and yes it is on topic seeing how I responded directly to a quote from this thread....
  3. God yes, I lost a paying client over this bug....
  4. http://walkercoderanger.com/blog/2014/02/typescript-isnt-the-answer/ https://www.google.com/amp/s/davidwalsh.name/typescript/amp i personally think TS is a flash In a pan and will never become standard... but if others feel different that's on them. If it works for you it works for you, but maybe y'all should consider calling this babylonTS now as to not falsely advertise. I am a huge fan boy of vanillaJS though so my opinion has some bias.
  5. cloth

    Sps system might be able to pull off cloth. One of my projects I wanted to do was soft body simulations in real time but have had like no time to work any any "want" projects... let me know what you dig up in this area there would be a few ways to accomplish this.
  6. @JCPalmer What browsers can handle webCL at the moment though? I've seen some bench mark reports for speed testing webCL vs just webGL and even though CL uses GL to render the 3D context the more intense calculations seem to work way faster. I only recently discovered it from reading up on some cutting edge college lectures that I dug up one day by luck. I want to be ahead of the ball and start learning it as much as possible because I have a feeling it's going to be the main language in the future do to your ability to tell it what pipeline it's using and I believe it makes real multithreading a possibility in browser.
  7. Yeah, as long as I don't get too drowsy from the medication I'll be on this today.
  8. @Flomotion My girlfriend orderd that I stay in bed all day and try to heal a little bit.... soooo I'm thinking of hooking up the laptop and getting back to this, maybe an update today. Let me see if I can focus enough for this today.
  9. @ozRocker Yeah we're gonna build the best 3D web gl engine ever, it's going to win biggly.... and we will make playcanvas pay for it.
  10. Delta totally came through and helped us out!!! If your having problems with doing the shaders you can hit me up in private messages dad, Ill help you out as much as I can I have a good understanding of them, but have to tinker to get them to work. I really think you could use my pseudo random zone calculations for your generator, and if your interested I can do a port of DasNoise for you as well.
  11. You sir are a gentleman and a scholar. Ohh man I was sooo close.... thanks @Deltakosh I was getting pretty frustrated with this! "vec4 worldPosition = world * vec4(position, 1.0);" "fFogDistance = (view * worldPosition).z;" this is what fixed it for me thank you!
  12. https://doc.babylonjs.com/tutorials/supporting_fog_with_shadermaterial I have beat this document and others into the ground trying to get fog to work on a custom shader... Does anyone have a working GLSL example not in typescript but like a actual BABYLON.Effect.ShadersStore version. I have been hitting my head against a wall trying to get this to work and the more I dig the more confused I am getting because it seems like everyone variables and uniforms are called different things and do not follow any sort of convention from example to example...
  13. whats stupming me up is when I try to figure out what the glsl really looks like for the standard material, I end up with this just going through the vertex shader "gl_Position = viewProjection * finalWorld * vec4(position, 1.0);" and I have never seen finalWorld anywhere, and am not sure wtf it is... I had it running I thought on an example, but any time I try to do it my object ends up disappearing). I know this is for your Terrain Editor, but If we can figure this out, Im sure it will help you as well. This is as close as I can get without really having consistent references... and it compiles... but does not work. Any ideas? this.header.scene.ambientColor = new BABYLON.Color3(0.6, 0.6, 1.0); this.header.scene.fogMode = BABYLON.Scene.FOGMODE_EXP; this.header.scene.distance = 0.01; this.header.scene.fogColor = new BABYLON.Color3(0.9, 0.9, 0.85); /*--- BUILD SHADERS ---*/ BABYLON.Effect.ShadersStore["oceanVertexShader"]= `precision highp float; // Attributes attribute vec3 position; attribute vec3 normal; attribute vec2 uv; // Uniforms uniform mat4 worldView,worldViewProjection; uniform mat3 view; uniform mat3 worldPosition; uniform float time; uniform vec3 cameraPosition; // Varying varying vec3 vPosition; varying vec3 vNormal; varying vec2 vUV; varying float vFogDistance; // Simplex 2D noise vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); } float snoise(vec2 v){ const vec4 C = vec4(0.211324865405187, 0.366025403784439,-0.577350269189626, 0.024390243902439); vec2 i = floor(v + dot(v, C.yy)); vec2 x0 = v - i + dot(i, C.xx); vec2 i1; i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0); vec4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod(i, 289.0); vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))+ i.x + vec3(0.0, i1.x, 1.0 )); vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),dot(x12.zw,x12.zw)), 0.0); m = m*m ; m = m*m ; vec3 x = 2.0 * fract(p * C.www) - 1.0; vec3 h = abs(x) - 0.5; vec3 ox = floor(x + 0.5); vec3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h ); vec3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g); } float wave(vec3 pos){ vec2 xy = vec2(pos.x, pos.z + (time / 1.))/vec2(1.0, 1.5); float h = snoise(xy); return h; } void main(void) { vec3 v = position; v.y = wave(v)*2.0; gl_Position = worldViewProjection * vec4(v, 1.0); vPosition = v; vNormal = normal; vUV = uv; vFogDistance = (view * position).z; }`; BABYLON.Effect.ShadersStore["oceanFragmentShader"]= `precision highp float; // Varying varying vec3 vPosition; varying vec3 vNormal; varying vec2 vUV; // Uniforms uniform mat4 world; uniform mat3 view; // Refs uniform vec3 cameraPosition; uniform sampler2D textureSampler; #define FOGMODE_NONE 0. #define FOGMODE_EXP 1. #define FOGMODE_EXP2 2. #define FOGMODE_LINEAR 3. #define E 2.71828 uniform vec4 vFogInfos; uniform vec3 vFogColor; varying float vFogDistance; float CalcFogFactor() { float fogCoeff = 1.0; float fogStart = vFogInfos.y; float fogEnd = vFogInfos.z; float fogDensity = vFogInfos.w; if (FOGMODE_LINEAR == vFogInfos.x) { fogCoeff = (fogEnd - vFogDistance) / (fogEnd - fogStart); } else if (FOGMODE_EXP == vFogInfos.x) { fogCoeff = 1.0 / pow(E, vFogDistance * fogDensity); } else if (FOGMODE_EXP2 == vFogInfos.x) { fogCoeff = 1.0 / pow(E, vFogDistance * vFogDistance * fogDensity * fogDensity); } return clamp(fogCoeff, 0.0, 1.0); } void main(void) { vec4 color = vec4(0.5, 0.5, 0.8, 1.0); float fog = CalcFogFactor(); color.rgb = fog * color.rgb + (1.0 - fog) * vFogColor; gl_FragColor = color; } ` // Compile var oceanMaterial = new BABYLON.ShaderMaterial("oceanShader", this.header.scene, { vertex: "ocean", fragment: "ocean", }, { attributes: ["position", "normal", "uv"], uniforms: ["world", "worldPosition", "worldView", "worldViewProjection", "view", "projection", "cameraPosition"] }); oceanMaterial.delta = 0; oceanMaterial.setFloat("time", 0); oceanMaterial.setVector3("cameraPosition", camera.position); oceanMaterial.backFaceCulling = false; //oceanMaterial.setMatrix("view", this.header.scene.getViewMatrix()); oceanMaterial.setVector3("vFogColor", this.header.scene.fogColor); /*--- BUILD SCENE SECTION ---*/ var water_top = BABYLON.MeshBuilder.CreateGround("water_top", {width: 200, height: 100, subdivsions: 10}, this.header.scene); water_top.material = oceanMaterial; /*--- BEFORE RENDER ---*/ this.header.scene.registerBeforeRender(function(){ oceanMaterial.delta += (self.header.scene.getAnimationRatio()/100.0); oceanMaterial.setFloat("time", oceanMaterial.delta); }); and I do get this error though Error: WebGL: uniformMatrix4fv: Function used differs from uniform size: 9 Sorry not trying to hyjack your thread, just noticed we are both fighting the same problem!
  14. I followed the dirrections on https://doc.babylonjs.com/tutorials/supporting_fog_with_shadermaterial but I can not get it to work... o_O.
  15. @Dad72 how did you merge the StandardMaterial? I am clueless on how to build my on glsl file out of the standard shader for some reason. I tried doing it from scratch but it was a no go...