PDA

View Full Version : A Question on Instancing and Surfacing



Farhad_azer
06-16-2015, 01:57 AM
Hi everybody,

How can we make a 2d texture to be placed over different piece of instancing engine as a single texture so that by tweaking scale and rotation etc it affects the overall appearance?

there is an old post on baking instancing via script but I had not tried it yet and wanted to have another solution.

thanks in advance.

lertola2
06-16-2015, 12:00 PM
Instances will always have the same texture as the base object. I don't know of any way to get around that. You can use the Python Bake Instances script to convert your instance to clones of the base object. To do this select the base object and then run the Bake Instance script. On my setup it is in the Utilities tab. But I am not sure if that is the default location for the button or if I put it there. Once you have converted your instances to clones you can texture the clones with image maps or procedural textures. Check the World Coordinates box in the texture layer to have your image map across all your clones together.

Farhad_azer
06-16-2015, 12:49 PM
Thank you so much. this was exactly what I was looking for. there is only one small problem. as soon as I do this objects increase in number. is it a bug or something? My object to be instanced have animation on it. could this be the reason? (I still don't have Lightwave 2015).

MSherak
06-16-2015, 02:16 PM
Hi everybody,

How can we make a 2d texture to be placed over different piece of instancing engine as a single texture so that by tweaking scale and rotation etc it affects the overall appearance?

there is an old post on baking instancing via script but I had not tried it yet and wanted to have another solution.

thanks in advance.


Instances will always have the same texture as the base object. I don't know of any way to get around that. You can use the Python Bake Instances script to convert your instance to clones of the base object. To do this select the base object and then run the Bake Instance script. On my setup it is in the Utilities tab. But I am not sure if that is the default location for the button or if I put it there. Once you have converted your instances to clones you can texture the clones with image maps or procedural textures. Check the World Coordinates box in the texture layer to have your image map across all your clones together.

You can replace the texture per instance if you want. Use the ID index and just make a gradient with different textures assigned to the inputs. (1,2,3,etc) Make your own vectors to control the textures. You can even tie in a overall texture to all of them by placing it in the inputs of the textures. Takes a little setup, but there is not much you can't do with nodes..

This is one box that is textured different per instance. All the textures are controlled with one pos,rot and scale.

-M

lertola2
06-16-2015, 03:58 PM
Thank you so much. this was exactly what I was looking for. there is only one small problem. as soon as I do this objects increase in number. is it a bug or something? My object to be instanced have animation on it. could this be the reason? (I still don't have Lightwave 2015).

Yes the number of objects increases because the script is putting a new clone of the the base object at every point where there is an instance. So this is not going to work well if you have a very large number of instances. How many instances do you have in your scene?


You can replace the texture per instance if you want. Use the ID index and just make a gradient with different textures assigned to the inputs. (1,2,3,etc) Make your own vectors to control the textures. You can even tie in a overall texture to all of them by placing it in the inputs of the textures. Takes a little setup, but there is not much you can't do with nodes..

This is one box that is textured different per instance. All the textures are controlled with one pos,rot and scale.

-M

MSherak that looks very interesting. But I don't see a way for this to solve Farhad_azer's problem. He wants all the instances to have the same texture but the texture should be in world coordinates so that each instance can show a different part of the texture. Plus even if there is some clever nodal setup that can produce the correct texture for each instance how would it be possible to apply it separately to each instance if there were many dozens or hundreds of instances?

jeric_synergy
06-17-2015, 01:13 PM
#backoftheclass

I figured you'd make an image Sequence, and tie it to the Instance Index.

Farhad_azer
06-17-2015, 01:35 PM
Dear lertola2, it is not a fixed project. I am just experimenting to learn more. the scene I was working had not huge amount of instances but...

Would you plz give me some hint to get rid of those extra copies? can I kind of send these instances to modeler to use uv mapping?

dear Msherak , what you said also will help me on other things rather than my question. I am terrified of nodes. sooner or later I should consider learning it. thanks for your help.

I did not understand you jeric_synergy. maybe I have not asked the question very clearly.

Slartibartfast
06-18-2015, 03:11 AM
128635

Is this what you mean Farhad_azer? The texture is static (relative to world) when the instances moves.

jwiede
06-18-2015, 03:24 AM
128635

Is this what you mean Farhad_azer? The texture is static (relative to world) when the instances moves.

If I understand Farhad's original statement (Farhad, please correct me if not), he wants the textures to remain locally static relative to each instance once generated, but each instance to be initially painted with a different "section" of the texture. Your solution solves the second part (they each get different sections of the texture), but fails the first part because as the instances move their textures' sections will freely shift between instances as they move w.r.t. world coordinates.

Jeric's approach has merit, but I'm kind of getting the impression from Farhad (again, Farhad, please correct me if I'm getting the wrong impression) that he's working with some kind of pre-existing texture atlas where he wants to map generated instances to areas of the atlas, so converting into selectable image sequence could involve quite significant re-texturing work.

Farhad, finding a solution might be a lot easier if you could give us a clearer notion of the texture in question, and how individual instances' textures are "distributed" in that texture?

Slartibartfast
06-18-2015, 06:09 AM
If I understand Farhad's original statement (Farhad, please correct me if not), he wants the textures to remain locally static relative to each instance once generated, but each instance to be initially painted with a different "section" of the texture. Your solution solves the second part (they each get different sections of the texture), but fails the first part because as the instances move their textures' sections will freely shift between instances as they move w.r.t. world coordinates.

Jeric's approach has merit, but I'm kind of getting the impression from Farhad (again, Farhad, please correct me if I'm getting the wrong impression) that he's working with some kind of pre-existing texture atlas where he wants to map generated instances to areas of the atlas, so converting into selectable image sequence could involve quite significant re-texturing work.

Farhad, finding a solution might be a lot easier if you could give us a clearer notion of the texture in question, and how individual instances' textures are "distributed" in that texture?

Ok, that's more difficult to do with instances. Haven't got a good idea now.. I suppose one must get the instances position @ frame 0 to feed into the texture position. But I'm not sure how to do that.

MSherak
06-18-2015, 04:50 PM
MSherak that looks very interesting. But I don't see a way for this to solve Farhad_azer's problem. He wants all the instances to have the same texture but the texture should be in world coordinates so that each instance can show a different part of the texture. Plus even if there is some clever nodal setup that can produce the correct texture for each instance how would it be possible to apply it separately to each instance if there were many dozens or hundreds of instances?

Don't see where he wants world coordinates for the texturing, more like instances to be mapped to a smaller portion of a larger tiled texture.

This again is easy but takes some setup time. Easier with UV's but can be done so long as you know the size of the image and the coordinates you want to use based on the size of the model. Think of it as assigning coordinate sizes to a model based on the instance ID number. Basically like I setup above but you use all the same texture with different coordinates. Yes that means for each instance you have you need a tag in the gradient that you can hook a texture up to for a specific model to use. But could use random just make sure to set it to stepped so there are no inbetweens. (there still might be some)

Things to check off the list to see if it will work:
1) Can instance a model, yes.
2) Can assign a texture per instance, yes.
3) Can assign a different coordinate per texture, yes.

This would be 10x easier if the Image Node would allow floating point numbers for the UV Tile inputs. Make one set of 1:1 UV's. Assign each texture a new UV's offset and tile scale for each instance. done. This could never be done with the old surfacing. Nodes are your friend!

lertola2
06-18-2015, 07:31 PM
Don't see where he wants world coordinates for the texturing, more like instances to be mapped to a smaller portion of a larger tiled texture.

This again is easy but takes some setup time. Easier with UV's but can be done so long as you know the size of the image and the coordinates you want to use based on the size of the model. Think of it as assigning coordinate sizes to a model based on the instance ID number. Basically like I setup above but you use all the same texture with different coordinates. Yes that means for each instance you have you need a tag in the gradient that you can hook a texture up to for a specific model to use. But could use random just make sure to set it to stepped so there are no inbetweens. (there still might be some)

Things to check off the list to see if it will work:
1) Can instance a model, yes.
2) Can assign a texture per instance, yes.
3) Can assign a different coordinate per texture, yes.

This would be 10x easier if the Image Node would allow floating point numbers for the UV Tile inputs. Make one set of 1:1 UV's. Assign each texture a new UV's offset and tile scale for each instance. done. This could never be done with the old surfacing. Nodes are your friend!

This sounds very interesting. I am not quite following every thing you are saying but you did get me to understand that instances can have different textures. The attached scene shows what I think Farhad_azer wants to achieve which is one texture covering all instances. Is that correct Farhad_azer?

http://forums.newtek.com/attachment.php?attachmentid=128642&d=1434677292

128642
128641

Farhad_azer
06-19-2015, 12:11 AM
Sorry, the questions that you are asking are above my knowledge. I am reviewing and working with the scene lertola2 sent me. plz give me a little time. I will post my answers.
Thanks everybody.

Farhad_azer
06-20-2015, 02:04 PM
Thanks everybody,

Dear Lertola2, I did follow the settings in ur scene, and I got the result I wanted. I was looking for the effect similar to revealing logo tutorial by Cody Burke in which an image plane will be assigned over all pieces generated from instance. the result that I was getting was the image on every single piece. I want to repeat the revealing of sth but by using instance.

May I also ask plz the reason for putting nodes in this manner? is it possible to get the same result without nodes (only for educational purpose)?

And finally is there a way to increase the amount of instances in array mode as there is no E button nect to the X,Y,Z instances? ( I guess this would only be possible with particles).

Thanks again, sorry if this was a totally beginner question. I have not used node editor so much and probably am missing more. the good thing is that also undo/redo works perfectly well in node editor.

lertola2
06-20-2015, 03:46 PM
Thanks everybody,

Dear Lertola2, I did follow the settings in ur scene, and I got the result I wanted. I was looking for the effect similar to revealing logo tutorial by Cody Burke in which an image plane will be assigned over all pieces generated from instance. the result that I was getting was the image on every single piece. I want to repeat the revealing of sth but by using instance.

May I also ask plz the reason for putting nodes in this manner? is it possible to get the same result without nodes (only for educational purpose)?

And finally is there a way to increase the amount of instances in array mode as there is no E button nect to the X,Y,Z instances? ( I guess this would only be possible with particles).

Thanks again, sorry if this was a totally beginner question. I have not used node editor so much and probably am missing more. the good thing is that also undo/redo works perfectly well in node editor.

I think you must use nodes to change the texture on instances. I was unaware that the node texture could be changed at all until MSherak pointed it out. I don't think you can get the same results without using nodes. Also I don't think you can dynamically change the number of instances in an array. But you could make a large array and then use procedural textures, gradients, or images to scale some of the instances to zero size so they won't be visible. There is also a node editor in the instance panel which could be helpful in animating the size of instances.