JBlack_UTD

Members
  • Content Count

    9
  • Joined

  • Last visited

  1. Yay! So I'm getting all the expected data from the textures and materials. I've left the BabylonJS terrain shaders alone, and I'm wondering if it's causing the terrainMaterials to not get light from point lights. There's a screenshot attached showing the unity scene and then the BabylonJS with a bright point light and a small spot light. The exporter is tweaked a bit to mess with exponents and intensity, but everything should be conducive to emulate the lighting conditions from Unity to BabylonJS! Also the standard material that gets imported loses its diffuse color, but I think that's a different problem that I've inadvertently caused elsewhere.
  2. Cool! So i added a customType string to the BabylonTerrainMaterial.cs file and it gave me this. babylon.max.js:4413 Uncaught TypeError: Cannot read property 'BabylonTerrainMaterial' of undefined I also tried passing just 'TerrainMaterial' and it gives the previously observed error. Edit: Because the customType has to be "BABYLON.TerrainMaterial" !! So it now imports into BabylonJS as a terrain material - exciting. Now I have to make it not black. Edit: which is apparently caused by alpha being 0. Set it to 1 and I can now see it.
  3. Yes I did! private BabylonTerrainMaterial DumpTerrainMaterial(Material material, Renderer renderer) { ///construct the material data ... if (material.HasProperty("_SplatMap")) { ... //copy material data and texture ... terrainMaterialsDictionary.Add(bMat.name, bMat); return bMat; } So I've emulated the functionality and it imports into Babylon with the mix, diffuse, and bump textures, except for instead of creating a terrain material, it creates a standard material. I've stepped through the code and it's even calling the functions inside babylon.terrainMaterial.js! Edit: although it isn't returning anything...
  4. I feel like I am still missing a vital piece of information... this other question is along the same train of thought: I would love to be able to get Unity to export certain properties. Among the various things, such as name, id, and other properties that get serialized and sent to BabylonJS and parsed by the .max.js file, however, I don't see how the BabylonJS engine is getting type information. Let's say I wanted to use a shader I made for unity to work in BabylonJS. I have a .shader which is assigned to a .material that has a few various .png images that determine color information. All of those are types of assets that can be packaged (copied), parsed, and then re-created in BabylonJS. Where the disconnect is happening is if I want that custom shader to look the same. I can't come in and define my own material type - I have to conform to ones already available. How could I get BabylonJS to look at external files for material data?
  5. Cool! I've made my terrain material entity, a DumpTerrainMaterial function in SceneBuilder.Materials.cs, and then I check to see if the shader matches my emulated one in SceneBuilder.Meshes.cs: ...else if (renderer.sharedMaterial.shader.name.Equals("BabylonJS/Terrain")) { babylonMesh.materialId = DumpTerrainMaterial(renderer.sharedMaterial, renderer).id; } else { babylonMesh.materialId = DumpMaterial(renderer.sharedMaterial, renderer).id; } which produces... another standard material. Which is more than I had before! Before the above code wouldn't even give me that much. The material in BabylonJS shows up as an unlit white solid color, which tells me it's not getting texture/shader data. To be honest I don't know how any of the materials are getting shader data since I'm doing all this through a gulp server, and I don't see any .fx or .ts files anywhere. Somewhere along the way, I'm not telling BabylonJS enough to create a terrain material. Unless I'm mistaken, it's falling back to creating a standard material, and then it fails to load a texture because I'm trying to assign "diffuseTexture1" instead of just "diffuseTexture".
  6. RIght, sorry - I wasn't specific enough. I've emulated the terrain material shader in Unity using shaderforge, and would ideally like to export that straight into BabylonJS. I've also manually created a terrain material in BabylonJS to understand how it works (via the extension). The disconnect is that the Unity exporter (via SceneBuilder.Material.cs) has DumpStandardMaterial and even DumpPBRMaterial , but not a DumpTerrainMaterial function. I'd be happy to make one, but the problem then becomes that the BabylonExport.Entities.dll doesn't seem to contain a definition for the terrain material (which is reasonable because it's an extension!). Should I be trying to add a custom definition akin to the entities, or should I be exporting data (such as paths) to BabylonJS so it can use the extension locally? And this goes for any custom shader/material that I might want to export from Unity to BabylonJS. I'm pretty far down the rabbit hole so I might as well...
  7. I don't see a way to export a terrain material from Unity. Is there a method I could use to export an array of textures, and then create the terrain material later in babylonJS with those textures?
  8. That seems to have done the trick! Thanks. for (var i = 0; i < newScene.lights.length; i++){ if(newScene.lights[i].getShadowGenerator()){ console.log("dingdingding."); newScene.meshes.forEach(function(mesh) { newScene.lights[i].getShadowGenerator().getShadowMap().renderList.push(mesh); }); continue; } ... }
  9. Hello, I'd like to access the babylonScene.ShadowGeneratorsList that SceneBuilder.Lights.cs uses, but I can't seem to find any variable that doesn't come up as undefined after I've called the SceneLoader.Load private void GenerateShadowsGenerator(Light light) { var generator = new BabylonShadowGenerator { lightId = GetID(light.gameObject), usePoissonSampling = light.shadows == LightShadows.Soft, mapSize = 256 + 256 * QualitySettings.GetQualityLevel(), bias = light.shadowBias / 10.0f, useBlurVarianceShadowMap = light.shadows == LightShadows.Soft }; var renderList = new List<string>(); foreach (var gameObject in gameObjects) { //why not deliver the boolean to the scene? I could use that boolean to manually create shadows inside babylon. var meshFilter = gameObject.GetComponent<MeshFilter>(); var renderer = gameObject.GetComponent<Renderer>(); if (meshFilter != null && renderer.shadowCastingMode != ShadowCastingMode.Off) { renderList.Add(GetID(gameObject)); continue; } var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>(); if (skinnedMesh != null && renderer.shadowCastingMode != ShadowCastingMode.Off) { renderList.Add(GetID(gameObject)); } } generator.renderList = renderList.ToArray(); babylonScene.ShadowGeneratorsList.Add(generator); //***How do i access this list in babylon?*** } The end goal here would be to emulate the Unity mesh renderer option to cast shadows or not. The exporter does this, but if I can't access the shadow generator list, I can't determine which meshes to push into the wanted shadow generators. That's my understanding of the problem at least. As an aside, I've created shadow generators for two point lights (manually), and I'm importing one spot light which I've positively determined has a shadow generator created for it somewhere. "shadowGenerators":[{"mapSize":1536,"bias":0.005,"lightId":"c21fd6a4-701a-4377-86b9-868b221c1c96","useVarianceShadowMap":false,"usePoissonSampling":true,"useBlurVarianceShadowMap":true,"blurScale":0,"blurBoxOffset":0,"renderList":["f808b945-1605-4e8f-8233-f75b89e55c71","0cc9fd1e-1a23-4c9e-9cef-5b0c87faf717","36d7e455-a32f-490a-b837-3043d6f30691","5091d4f8-2767-4e7e-acb6-a7c179b33583","c5313fc0-4edd-43d7-8dcf-85f76e83905f","d3d119e6-37f5-4725-af03-f470a755ac93","d5d11567-f959-4291-b784-ffb07089e6bd","9141800a-91a8-4d51-bceb-85df54d49e39","acce9ece-cd8f-42fb-98e7-53ff7de56315","cd22cc1d-07f7-4845-9de2-967f42eabf5b","0ad378ab-6f73-4861-91a9-bc649ffd4759","a8e8b351-71a2-4bb9-a995-736b637615a6","385b2d6a-a789-4a2a-ba99-73c45f096c8a","d056b786-d3d8-45dc-ae61-509a34b17f1a","0bf62911-a3cf-4bd8-a0b4-96fd20a89fd2","fdfc93be-5a6c-4049-80de-c6912168f1c8","25efb981-7f78-4c5c-8e28-cfde40b304f5","1bf1b3b6-b0fe-4fe5-a5af-1509ed156dbc","673a7d44-10c1-47e4-9d12-2c55322f3b28","aa4d1889-0951-4d43-81d8-5d774a7012d2","157582a5-5887-4661-bbf8-29aaa6da108c","7b3f2c8d-447b-41fa-9366-d007137e6a3c","c4860f5e-d38e-4285-a098-3a158564dd8e","f5e3a43a-4475-4c67-941d-bab8a377290e","49374c28-a289-471b-83df-2af6773d18b2","d8511075-b08c-47ea-a779-7720c91351ae","e2807f9b-3807-4ae0-bdff-86ab12195672","d730e55a-948c-4ac5-beef-a9eb8ae12479"]}],"skeletons":[],"actions":null} The only thing left I have to do is determine which meshes can cast shadows, and then push those meshes into the shadow generator render lists. Thank you for your time.