Forum

Tutorial for applying materials and baked materials

30 December 2015 04:39 #6171
Hi,

I am doing planet animations and am not clear on how to apply materials to objects in Blend4Web. I have been using Blender Cycles materials nodes almost exclusively from the start, but I'm having trouble getting the materials on in Blend4Web. Everything will look fine in the material and texture previews and in the viewport, but when I do a fast preview the material will not show up on the object.

In this post, there is a mention of using a geometry node and applying modifiers, but I'm not sure how to do that. https://www.blend4web.com/en/forums/topic/1335/

My projects are mostly being done in Windows because I am able to have the CUDA setting enabled to use
GPU rendering, which I was not able to get working in Linux. These problems could be related to Windows, so I am going to go back to Linux to see if I have better luck.

A detailed beginners tutorial on UV unwrapping a sphere, applying materials step by step, and also how to bake materials in Blenders Cycles and import them to Blend4Web would be very useful.

Thanks
30 December 2015 09:49 #6172
Hi,

I have tried applying the image as a material in the attached .blend file, but I'm still missing something. The exported HTML file
does not contain a material. This file was done in 64 bit Linux with Blender 2.75.

Also for some reason, my Linux version of Blender with Blend4web installed does not have a fast preview button at the bottom or on the right hand side in the render section.

If you can steer me in the right direction I would be most grateful.

Thanks
30 December 2015 11:31 #6181
Hello,

It is expected behavior actually. Currently Blend4web node system doesn't read internal structure of a material used inside material node. It only receives shading settings: Diffuse Shader, Specular Shader etc. Thus, we get white instead of textured surface. You need to recreate this texture in node structure itself.
I have attached a corrected file.

In the nearest future your setup will be supported as well.

Also for some reason, my Linux version of Blender with Blend4web installed does not have a fast preview button at the bottom or on the right hand side in the render section.
Were you able to Open SDK Index or Project Manager from Blender? Probably, development server was down for some reason. Does it work after restarting Blender?

Blend4Web developer
30 December 2015 19:57 #6190
Hi Evgeny,

Thank you for supplying the corrected blend file. I still get a blank sphere, but I think for a different reason.

The development server is shown as running, and restarting Blender does not change the appearance of the menu - there is still no fast preview button. I am able to open the SDK index, but Linux is using Konqueror browser to open it, even though Konqueror is not my default browser. When I export the blend file to HTML, it is also using Konqueror which in not WebGL capable.

Is there a place in Blend4web that I can change which browser is being used? This will probably fix the problem.

Also, can you tell me if you are able to get Linux set up to use the GPU for rendering? I have an NVidia card.

Thanks
31 December 2015 01:24 #6192
Hi Evgeny,

I found a way to get Blender to use Firefox instead of Konqueror by creating a new profile, reinstalling Blender and Blend4web.

But I still get a blank sphere. If I open any other blend file and export to HTML it runs fine in Firefox, but not the file I was working on ( even the corrected one ) Is there something else I need to check? Does this file export properly on your end?

I have reattached it in case you need it.

Thanks
31 December 2015 01:54 #6193
Hi Evgeny,

Sorry for the bother! I found the problem - the original "geometry" shader did not have "UV map" entered in the top field.

Works fine now. Thanks for your help.

05 January 2017 17:10 #14976
Hello I have the same issue i try with python to create an object and add an material with a texture

<code>
bpy.ops.mesh.primitive_plane_add(radius=r, view_align=False, enter_editmode=False, location=(0, 0, d['int_levels']))
layer_plane = bpy.context.object
layer_plane.name = "LAYER_PLANE"
layer_mat = bpy.data.materials.new('MAT_CONNECT')
layertex = bpy.data.textures.new("Layer_Texture", 'IMAGE')
img = bpy.data.images.load("D:\pyhasse\mis-dev\hd3d-viewer\layer.png")
layertex.image = img
layerslot = layer_mat.texture_slots.add()
layerslot.texture = layertex
layerslot.texture_coords = 'GLOBAL'
setColor(layer_plane, layer_mat, connection_color[1])
</code>
The setColor is a function that made last steps but not the necessary one the point is the part where i ad the texture to the material

In Blender Render Enginers it worked fine but only in the fast preview i get no image texture on the objects what i have to change ?

Many Thanks for help
05 January 2017 23:00 #14985
Blend4Web doesn't support GLOBAL coordinates for non-node materials yet. I think, this is the problem.
Blend4Web developer
06 January 2017 08:55 #14991
OK Thx I will try to change this and will give a reply.

Ok I have changed the probperty to Object but it have the same result.

Is there a hint how i can programm the connection like they would bild with a node editor ?

UPDATE:

Option Generated has worked looks not so good but i can handle this many thx
 
Please register or log in to leave a reply.