davrous Posted June 17, 2014 Share Posted June 17, 2014 Hi, I should have fixed a couple of bugs in the sandbox. I've also added support for scenes using .DDS or .TGA textures. I haven't done a lot of tests so I'm waiting on your feedbacks. Bye, Davud GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 18, 2014 Share Posted June 18, 2014 Any thoughts on supporting procedural textures? If noise could be implemented, then some sort of mapping back to Blender might be achieved. I have looked at one of the shaders source listings the Blender python API can produce (STUCCI). Was very large, kind of kitchen sink with like 30 or more functions that never get called. Not sure if Blender uses them, as it is CPU based. Maybe it is for that cycles render. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 19, 2014 Share Posted June 19, 2014 Just as a follow up, I ran across this GPU shader doc for Blender http://www.blender.org/documentation/blender_python_api_2_70_release/gpu.html . I decided to print out the glsl for 2 of these that I had made for the Gus, The gingerbreadman tutorial. I put both the little vertex shader and fragment shader in the same file. Here is the python code (should look familar): # Textures self.textures = [] self.shaders = [] textures = [mtex for mtex in material.texture_slots if mtex and mtex.texture] for mtex in textures: if mtex.texture.type == 'IMAGE': if mtex.texture.image: if (mtex.use_map_color_diffuse and (mtex.texture_coords != 'REFLECTION')): # Diffuse self.textures.append(Texture("diffuseTexture", mtex.diffuse_color_factor, mtex, filepath)) if mtex.use_map_ambient: # Ambient self.textures.append(Texture("ambientTexture", mtex.ambient_factor, mtex, filepath)) if mtex.use_map_alpha: # Opacity self.textures.append(Texture("opacityTexture", mtex.alpha_factor, mtex, filepath)) if mtex.use_map_color_diffuse and (mtex.texture_coords == 'REFLECTION'): # Reflection self.textures.append(Texture("reflectionTexture", mtex.diffuse_color_factor, mtex, filepath)) if mtex.use_map_emit: # Emissive self.textures.append(Texture("emissiveTexture", mtex.emit_factor, mtex, filepath)) if mtex.use_map_normal: # Bump self.textures.append(Texture("bumpTexture", mtex.emit_factor, mtex, filepath)) # else:# TowerOfBabel.log('WARNING texture type not currently supported: ' + mtex.texture.type + ", ignored.") else: #type == 'STUCCI' or 'NOISE' shader = gpu.export_shader(scene, material)# self.shaders.append(shader["fragment"]) glsl_handler = open("/home/jeff/Desktop/" + mtex.texture.type + ".glsl", 'w') glsl_handler.write(shader["vertex"]) glsl_handler.write("\n//#############################################################################\n") glsl_handler.write(shader["fragment"]) glsl_handler.close() Here is the output. I cannot do anything with it, but that does not mean some else can't. NOISE.glsl.txtSTUCCI.glsl.txt Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 11, 2015 Share Posted May 11, 2015 I tacked a question on to this topic / announcement a year ago. Fast forward a year with Procedural shaders added as of BJS 2.0. Am starting to think that procedural textures from Blender could at least be mapped. Here is the dropdown types list: I see there is wood, marble, & clouds in BJS. How well they match up, I do not know. From the Blender vertex shader, there are these varying var to Fragment:varying vec3 varposition;varying vec3 varnormal;in our default vertex shader, there is:// Outputvarying vec3 vPositionW;#ifdef NORMALvarying vec3 vNormalW;#endifThere are 8 inexplicable uniforms in the fragment shader of the NOISE from above. Not sure, but if they are passed in, then there must be UI to set there value. Does anyone think this is remotely possible? Wingnut 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 11, 2015 Share Posted May 11, 2015 It should be:) pulling in @meulta Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 18, 2015 Share Posted May 18, 2015 Well, I am finding UI for specific procedural textures. Working with Wood. There is:noise_basis: Sine, Saw, & Triwood_type: Bands, Rings, Band Noise, & Ring Noise Several noise settings (available only for types Band Noise & Ring Noise)noise_type:Soft & Hardnoise_basis: dropdown list with manynoise_scale: numbernoise_nabla: numbernoise_turbulence: numberIf strictly just mapping to BJS wood for now, the only settings are size, ampscale, & woodColor. As there are no pictures of BJS wood samples that I know of here is a swag:Type of wood is Bands,noise_basis is used to set ampscale to 1 of 3 values.Have no clue what size isNot sure what color to use. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 20, 2015 Share Posted May 20, 2015 Like it!!! do you plan to subimit a PR for this? I would love to have it in 2.1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 20, 2015 Share Posted May 20, 2015 As long as a .babylon handles procedural textures, it is already there. I am not going to edit Fileloader. I would try to implement in TOB first. It is faster, and not reliant on FileLoader. Would put as much as possible in pass 1, so would be cut and paste for the Blender mapping part. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 21, 2015 Share Posted May 21, 2015 Sounds good Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 24, 2015 Share Posted June 24, 2015 Well, I have embarked on texture baking for Blender procedural textures. After some fumbling, I am getting output all the way to a scene. Have come to the conclusion that the script cannot just render the entire mesh as in the scene. This takes into account lights & this precludes normal textures, since there is only one image. Planning to switch to multiple bakes as required. Anyway, working with what I have so far, I found that uv.smart_project gave the best results. Still you can see "seams" though. I was able to minimize by upping my image size. This caused me to do a whole bunch of formats. I tried the TARGA format, but it would not load in a scene. Here is the file: targa.zip Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 24, 2015 Share Posted June 24, 2015 what is the error reported? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 24, 2015 Share Posted June 24, 2015 No actual error in the console. Scene loads, but missing the mesh, though the shadow of the mesh, not baked, is visible. All I have to do is switch to jpg or png, and everything is fine. Targa file displays when I open it with the Linux Image Viewer program. This is not a big deal for me. Targa format is the biggest, except for JPEG2000. Just thought I would give the feedback asked for by the original post. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 25, 2015 Share Posted June 25, 2015 can you provide the scene alongside the texture? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 25, 2015 Share Posted June 25, 2015 Yes, not at the right machine now. Will put html & source in zip, along with targa & jpg versions. Change either the name of the image file or change in line source file to control which gets loaded. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 29, 2015 Share Posted June 29, 2015 Been awol a few days. Here is the full zip as described. Note how arc-rotate camera is initialized wrong. Will look into why, along with changing camera to be separated from renderer, implemented in 2.1. Would have an issue implementing this in the .babylon version of the exporter, I think. Does Fileloader work with a rig field? Also, need to upgrade Blender exporter for 2.0 shadows. In the request site, I asked for a picture of the UI 3DMax used.http://babylonjs.uservoice.com/forums/267546-general/suggestions/7742544-blender-addon-support-for-variance-shadows targa_full_scene.zip Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 29, 2015 Share Posted June 29, 2015 The texture works for me. Did you allowed .tga mime type(actually I see that your file has no extension. this could be the reason why as your webserver may not know how to serve it) Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 29, 2015 Share Posted June 29, 2015 Ok, I didn't know the extension for this was .tga and not .targa. I switched file to have .tga & Firefox used it. I do not actually use a web-server most of the time, just double click the html file, unless running CocoonJS from a Tablet or something. 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.