gryff Posted July 15, 2016 Share Posted July 15, 2016 By chance a few days ago, I was looking at a .babylon file created with 3DMax and noticed this code: [{"name":"Default light","id":"cd9cab9f-3a03-4c2a-a30f-0310239c7ebc","parentId":null,"position":null,"direction":[0.0,1.0,0.0], "type":3,"diffuse":[1.0,1.0,1.0],"specular":[1.0,1.0,1.0],"intensity":1.0,"range":3.40282347E+38,"exponent":0.0,"angle":0.0,"groundColor":[0.0,0.0,0.0], "excludedMeshesIds":null,"includedOnlyMeshesIds":null,"autoAnimate":false,"autoAnimateFrom":0,"autoAnimateTo":0,"autoAnimateLoop":false,"animations":null}], which contains "excludedMeshesIds" and "includedOnlyMeshes". Checking the 3DMax exporter I find under Exported Features Lights : Inclusion / exclusion lists. This feature is not available with Blender So I thought about it and set up a simple scene example (see image below). This scene contains 4 "rooms" (4 planes with a red, blue, green or purple colour) each assigned to one of 4 layers with an corresponding name (Layers in the image). A PointLight (R,B,G,P)is then assigned to each of the 4 layers also and for each of these lights the "This Layer Only" box is checked (yellow rectangle in image). So, my thinking is that it should be possible to create Inclusion/Exclusion lists from layers and lights using such a setup. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 15, 2016 Share Posted July 15, 2016 This has a few things going for it: Can use existing UI, Blender interprets the function the same way, so can test render there It is a little late in dev cycle for next release of TOB though. It is essentially done, ready for QA. It has a new feature related to lights. On the materials for a mesh, you can now specify a maxSimulatneousLights property, default 4. This is added for iOS & Android. Setting a lower value allows larger skeletons to GPU skin. Post a test blend. We will see what happens. As far as getting this into the .babylon exporter, 4.6.1 is the last version I am going to PR. TOB 5.0 is a modern Blender zip file plug-in architecture. It is an 18 python file directory, instead of a massive single file. If DK wishes to stay with the single file, 4.6.1 is the last version from me. Quote Link to comment Share on other sites More sharing options...
gryff Posted July 15, 2016 Author Share Posted July 15, 2016 @JCPalmer : Here is a file Jeff it contains the.blend and the .babylon. The scene contains 5 lights - four PointLights and a Hemi. If I drop the .babylon file into the sandbox - only the 4 PointLights are being used (the Hemi was the first light added - and so is ignored). You might want to activate the Layer Management addon first -it was added with Blender 2.72 onwards. Then clicking on the "eye" (see image above) will hide/show the contents of the named layer. Lights.zip cheers, gryff JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 1, 2016 Share Posted August 1, 2016 Implemented. When "This Layer Only" is checked, includeOnlyMeshesIds is written. Here is light definition as it comes out of TOB for your scene: function defineLights(scene) { if (Number(B.Engine.Version.substr(0, B.Engine.Version.lastIndexOf("."))) < 2.4) throw "Babylon version too old"; B.Tools.Log('In light_export1.defineLights'); var light; light = new B.PointLight("Point.purple", new B.Vector3(-5.7898,3,5.1062), scene); light.intensity = 2; light.range = 4; light.diffuse = new B.Color3(1,1,1); light.specular = new B.Color3(1,1,1); light._includedOnlyMeshesIds = ["cylinder_purple","room04"]; light = new B.PointLight("Point.green", new B.Vector3(5.2102,3,5.1062), scene); light.intensity = 2; light.range = 4; light.diffuse = new B.Color3(1,1,1); light.specular = new B.Color3(1,1,1); light._includedOnlyMeshesIds = ["sphere_green","room03"]; light = new B.PointLight("Point.blue", new B.Vector3(5.2102,3,-4.8938), scene); light.intensity = 2; light.range = 4; light.diffuse = new B.Color3(1,1,1); light.specular = new B.Color3(1,1,1); light._includedOnlyMeshesIds = ["cone_blue","room02"]; light = new B.PointLight("Point_red", new B.Vector3(-5.7898,3,-4.8938), scene); light.intensity = 2; light.range = 4; light.diffuse = new B.Color3(1,1,1); light.specular = new B.Color3(1,1,1); light._includedOnlyMeshesIds = ["cube_red","room01"]; light = new B.HemisphericLight("Hemi", new B.Vector3(0,1,0), scene); light.groundColor = new B.Color3(0,0,0); light.intensity = 1; light.diffuse = new B.Color3(1,1,1); light.specular = new B.Color3(1,1,1); } light_export1.defineLights = defineLights; All the cubes are lit, though I had to move the camera to see each of the room planes: Quote Link to comment Share on other sites More sharing options...
gryff Posted August 2, 2016 Author Share Posted August 2, 2016 @JCPalmer 7 hours ago, JCPalmer said: Here is light definition as it comes out of TOB for your scene Do I take it Jeff that it is not available for the standard BE exporter which according to the github page was last updated "2 months ago" ? cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 2, 2016 Share Posted August 2, 2016 Yeah, TOB has not been updated in 6 months. Am now testing everything. Plan on updating TOB first, without readme changes. Next would be QI, with TOB readme changes. Would then build a 5.0 .babylon exporter. It will be a .zip file, and a sub-directory or source files like 3DsMax is. Not planning on deleting the monolithic 'io_export_babylon.py' initially, but not going update it. There is going to be some transition in that loading a zip file will not install over 4.6.1. Might actually be a good idea in the short term. Zip files can have versions in the name, as long as the top level directory inside stays the same. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 2, 2016 Share Posted August 2, 2016 dont change anything i already use this as creative fx Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 2, 2016 Share Posted August 2, 2016 No idea what creative fx is. Both 'tower_of_babel.py' & 'io_export_babylon.py' will be left in their respective repositories. They are dead to me, so no fear I will ever change them. DK can delete them after a while. I just hit a wall in my materials testing. After making required changes for Cycles for 2.77a it works in 2.77a, but hangs sometimes. It still runs for 2.76, but bakes terrible. Looks like no winning move. The 2.77b comes in the source code download. Not really acceptable. Switching back to little things in QI & my own stuff. No winning move right now. Just got some kind of notice from NewEgg yesterday about Some kind of class action suit being made for NVidia GTX 960. Hope that is not making things worse. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 2, 2016 Share Posted August 2, 2016 @JCPalmer hey, man, don't give up, blender exporter is awesome! i use it with 2.75. Most of the users are just don't know how to bake textures. Not your problem. creative effect = creative fx the 5 cubes are on a different layer so the lights are skippedhttp://babylonjs-playground.com/#1DLDGX#0 the Best@gryff var mat = new BABYLON.StandardMaterial("mat", scene); mat.maxSimultaneousLights =12; Quote Link to comment Share on other sites More sharing options...
gryff Posted August 3, 2016 Author Share Posted August 3, 2016 @JCPalmer : I have to agree with @Nabroski "the exporter is awesome" and you have added some neat features for working with animations. I gather the NVidia thing involves paying people a "rebate" because of misleading specs on various video cards. @Nabroski : I know you can alter the number of lights. What I would like to do is restrict what gets illuminated. So only objects in one room get illuminated by the light in that room. cheers, gryff : Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 3, 2016 Share Posted August 3, 2016 @gryff http://www.babylonjs-playground.com/#RBMUC#2 light.includedOnlyMeshes = [mesh1,mesh2,mesh3]; ? Quote Link to comment Share on other sites More sharing options...
gryff Posted August 3, 2016 Author Share Posted August 3, 2016 @Nabroski; Yes, I know it can be done with code - and have used it several times. If you look back in the forum threads "included OnlyMeshes" was a suggestion that I made 2 years ago and @Dad72 kind of "seconded" it, and so it was added to BJS. I have used it a number of times by coding it in like your demo. Just something I would like to see added to BE so that complex scenes become easier to layout. cheers, gryff Nabroski 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.