Search the Community
Showing results for tags 'custom shader'.
-
hi guys, I am new in BabylonJS, and trying to build some PBR materials with special effects, for example "thin film iridescence" in BabylonJS. I am learning something about PBR-Material and building my own PBR-Shader. I built a basic PBR-Shader, and now I want to do something more with IBL(image based lighting) and hdr. For Specular IBL i need to use textureLod Function from openGL to load mipmap according to the roughness levels. I tried something, but i always get the error "ERROR: 0:51: 'textureLod' : no matching overloaded function found". hier is what i tried. in HTML file i added : var engine = new BABYLON.Engine(canvas, false); engine.getCaps().textureLOD = true; In fragment shader i added #extension GL_EXT_shader_texture_lod : enable and in fragment shader i tried to use textureLod like this: vec3 prefilteredColor = texture2DLodEXT(equirectangularMap, R, roughness * MAX_REFLECTION_LOD); then i got the error..."ERROR: 0:51: 'textureLod' : no matching overloaded function found" I found some examples about textureLod and BabylonJS in playground, but non of them works. Do you have any idea about this topic? thanks, Sonja
-
Folks, hi, again!!! I trying use BJS.DynamicTexture for draw in and next use in custom shader, but shader ignore geometry with shader material if i try set that texture as samplier2D. And do not generate any Errors (( If we switch off DynamicTexture or use simple Texture - all is ok. Sorry, i can't make this case in PG. Try show situation here: // var dataTexture = new BJS.Texture('/accel/static/i/fx/.../name.jpg',scene,true,false,0,function(){loadedTextures--;}); // its work var dataTexture = new BJS.DynamicTexture("dataTx",{width:2048,height:2048}, scene,false,0); // its dosent work // later, when all textures is ready... var shader = new BABYLON.ShaderMaterial("myShader", scene, "/accel/static/js/...", { attributes: ["position", "normal","uv"], uniforms: ["world", "worldView", "worldViewProjection", "view", "projection"] }); shader.setTexture ("dataTx", dataTexture, scene ); myGeom.material = shader; in GLSL fragment uniform sampler2D dataTx; all is ok, if we change DynamicTexture to Texture. Where i make wrong turn? ))
-
Hey folks, first of all: thank you for this great forum. It came to the rescue a few times, now. So, thanks everyone, who's participating. I'm currently working on an idea, where I would like to project a spherical panorama texture to a mesh from inside (meaning from the viewpoint). Similar to a standard VR-Viewer, where the texture is mapped on a sphere from inside. But in my case I would like to map it on the actual scene-mesh which I get from 3dsmax. Now, I know, that I could create the UV's or bake the texture in 3dsmax, but I want to switch between two camera positions and therefore change the projected texture and the center of the spherical projection. I already got camera mapping to work with a planar image like this: http://www.babylonjs-playground.com/#203BJM#2 but that's not exactly what I need. My image has to get spherical wrapped around the camera AND stay in position, while the camera moves around. Is this understandable? I could provide a small scene, which I need to create, first, as my actual scene is way too big and consists of too many elements. But maybe someone already got a solution or an idea. I'm not even sure, if this is possible with babylonjs-coordinates modes or has to be solved with a custom shader. thanks
- 7 replies
-
- projection mapping
- spherical projection
-
(and 3 more)
Tagged with:
-
Hey Folks! In our scene we have some images with transparency on quads. The transparency is just used to mask the silhouettes of the image, so we have no larger half- transparent areas. So far we used the default shader for this, which produced nice silhouettes. All these Objekt are registered in a shadow generator from which we extract the shadow map an pass it in a custom shader. After writing our own shader for the images we ran into a problem: The shadow generator now only takes the quad into account, not the transparency of the image. Therefor the shadows of these images are square. When constructing the custom shader we tell baby- lon to use alpha blending and we also tell the shadow- generator to use transparency shadows. The diffuse texture is simply loaded with a texture sampler in- cluding the alpha channel. We even tried to clip frag- ments under a certain value but the shadow genera- tor still ignores it. We looked through the default shader but couldn't find anything that's helping us in this matter. We found the opacity map, which to our understanding is just a separate, black and white masking texture. So our question is: What steps are necessiary to generate shadow silhouettes based on the alpha channel of an objects texture? As we said, clipping with a threshold or cutout for that matter would be enough. Thank you for your time -Mainequin Team
-
Hello, this is my first post, but visit the forum for a while and am thrilled. :-) I'm currently working on a Babylon project and I'm using a CustomShader (ShaderMaterial) for the Meshes. Now I wanted to use mesh.dispose(); and mesh.material.dispose(); to remove the textures, but it does not work. Whenever I check the size with scene.textures.length, it becomes more and more. What helps?