Change mesh texture in Blend4Web application
18 September 2015 11:15
Hi guys
First, thanks to the developers for Blend4Web! I am enjoying it, find it intuitive to use and can see many applications.
Alright, here is my question.
We are evaluating Blend4Web for an web application we want to develop.
I have some coding experience but I'm more of an artist so I thought it would be easier to ask if the general idea can be achieved in practice.
Very briefly we want to have WebGL application running on web page.
On the same page the user can select a texture, which would cause that texture to be applied to an object in the WebGL app. Alternatively the texture choice can also happen in the app but it should be possible to add more textures without rebuilding the app.
It's also important that the dimensions of each individual texture can be specified in some way. I think this can be achieved by changing the texture mapping size during runtime.
Hope that makes sense.
Does that sound like something that can be achieved with relative ease?
If yes, could you recommend a course of action (even a broad one would be of great help)?
Any helpful input would be greatly appreciated!
First, thanks to the developers for Blend4Web! I am enjoying it, find it intuitive to use and can see many applications.
Alright, here is my question.
We are evaluating Blend4Web for an web application we want to develop.
I have some coding experience but I'm more of an artist so I thought it would be easier to ask if the general idea can be achieved in practice.
Very briefly we want to have WebGL application running on web page.
On the same page the user can select a texture, which would cause that texture to be applied to an object in the WebGL app. Alternatively the texture choice can also happen in the app but it should be possible to add more textures without rebuilding the app.
It's also important that the dimensions of each individual texture can be specified in some way. I think this can be achieved by changing the texture mapping size during runtime.
Hope that makes sense.
Does that sound like something that can be achieved with relative ease?
If yes, could you recommend a course of action (even a broad one would be of great help)?
Any helpful input would be greatly appreciated!
18 September 2015 13:00
Hello and welcome to the forum!
The overall answer is - yes, you can. The question is - when relative easiness ends and "relative difficultness" starts :)
I think it won't be so hard. I recommend using canvas textures: here you can see an example.
And about mapping: First, node material must be used. Right now it is possible to manipulate with two nodes: Value and RGB.
I made an easy node setup: size of texture mapping is controlled only with one Value node, so there won't be a problem to control it via sliders, for example. I highlighted some node inputs/outputs for easier understanding what goes where:
So, on first pic Value = 1, on the second Value =5:
About API method that can be used to set and control Value node you can read here. Also you can see here an example of using sliders.
Hope it helps!
UV_scale.blend
The overall answer is - yes, you can. The question is - when relative easiness ends and "relative difficultness" starts :)
I think it won't be so hard. I recommend using canvas textures: here you can see an example.
And about mapping: First, node material must be used. Right now it is possible to manipulate with two nodes: Value and RGB.
I made an easy node setup: size of texture mapping is controlled only with one Value node, so there won't be a problem to control it via sliders, for example. I highlighted some node inputs/outputs for easier understanding what goes where:
So, on first pic Value = 1, on the second Value =5:
About API method that can be used to set and control Value node you can read here. Also you can see here an example of using sliders.
Hope it helps!
UV_scale.blend
21 September 2015 05:17
28 October 2015 11:21