Jump to content
catchyid

creating texture files procedurally (and backing to desk)

Recommended Posts

Hi,

I don't have any experience about this topic, so my question could be a total dumb :) 

I have a 3d model (i.e. alembic) with uv. My goal is to paint in 3D some colors on the model mesh (the painting is done procedurally) then save a uv map containing the procedural painting (let's say as .png). The goal is to load and use this newly generated texture in another shading program. Is this possible and how?

Thanks,

Share this post


Link to post
Share on other sites

Hi Khaled,

you can transfer geometry shapes and attributes to pixel maps with VEX functions such as uvsample(), xyzdist(), primuv(), volumesample() and nearpoint() inside a VOP2COP Generator. 

I attached examples covering:

  1. Transferring attributes
  2. Blending image textures by attributes
  3. Tracing points
  4. Tracing closed 2D curves
  5. Tracing open 3D curves
  6. Tracing flattened meshes
  7. Sampling volumes

Combining those should give you a good variety of procedural image painting options, either directly or for masking:

image.png.9af8ace80f766b0332dd7251e4b2be79.png image.png.8d159850d9f7528f95876202120fb97e.png image.png.48aadf95191b07b9b2d403358d2358e6.png image.png.6eb429d33c6217e0256da777a706ee0d.png image.png.68890a47d6f7b507b2c6704ff12f466c.png image.png.e99211d20ddb00d7ab6f93680e7bb875.png image.png.2be0b4ab03e4d0ad7c5094c60772c55e.png

Another option esp. for baking ambient occlusion or even rendering perspective views would be raytracing with the intersect() function.

GEO_to_COPs.hipnc

Edited by konstantin magnus
  • Like 6

Share this post


Link to post
Share on other sites

Thaaaaaaaaaaaanks guys, I will look at your files you sent me :) Once more, thaaanks a lot :)

Share this post


Link to post
Share on other sites
On 04/10/2019 at 3:04 PM, konstantin magnus said:

Hi Khaled,

you can transfer geometry shapes and attributes to pixel maps with VEX functions such as uvsample(), xyzdist(), primuv(), volumesample() and nearpoint() inside a VOP2COP Generator. 

I attached examples covering:

  1. Transferring attributes
  2. Blending image textures by attributes
  3. Tracing points
  4. Tracing closed 2D curves
  5. Tracing open 3D curves
  6. Tracing flattened meshes
  7. Sampling volumes

Combining those should give you a good variety of procedural image painting options, either directly or for masking:

image.png.9af8ace80f766b0332dd7251e4b2be79.png image.png.8d159850d9f7528f95876202120fb97e.png image.png.48aadf95191b07b9b2d403358d2358e6.png image.png.6eb429d33c6217e0256da777a706ee0d.png image.png.68890a47d6f7b507b2c6704ff12f466c.png image.png.e99211d20ddb00d7ab6f93680e7bb875.png image.png.2be0b4ab03e4d0ad7c5094c60772c55e.png

Another option esp. for baking ambient occlusion or even rendering perspective views would be raytracing with the intersect() function.

GEO_to_COPs.hipnc

 

Edited by vinyvince

Share this post


Link to post
Share on other sites

Hi Vincent,

you can use those maps as masks when texturing. They transfer geometry information and potentially all sorts of attributes.

Share this post


Link to post
Share on other sites

Yes, this is just a technical concept for getting all kinds of geometries and their attributes from GEO- to COP-context. You can potentially create very specific maps with this. But it's not necessarily meant to be fed directly to an artist.

Share this post


Link to post
Share on other sites
On 04/10/2019 at 3:04 PM, konstantin magnus said:

Hi Khaled,

you can transfer geometry shapes and attributes to pixel maps with VEX functions such as uvsample(), xyzdist(), primuv(), volumesample() and nearpoint() inside a VOP2COP Generator. 

I attached examples covering:

  1. Transferring attributes
  2. Blending image textures by attributes
  3. Tracing points
  4. Tracing closed 2D curves
  5. Tracing open 3D curves
  6. Tracing flattened meshes
  7. Sampling volumes

Combining those should give you a good variety of procedural image painting options, either directly or for masking:

image.png.9af8ace80f766b0332dd7251e4b2be79.png image.png.8d159850d9f7528f95876202120fb97e.png image.png.48aadf95191b07b9b2d403358d2358e6.png image.png.6eb429d33c6217e0256da777a706ee0d.png image.png.68890a47d6f7b507b2c6704ff12f466c.png image.png.e99211d20ddb00d7ab6f93680e7bb875.png image.png.2be0b4ab03e4d0ad7c5094c60772c55e.png

Another option esp. for baking ambient occlusion or even rendering perspective views would be raytracing with the intersect() function.

GEO_to_COPs.hipnc

 

The snippest to grab N attribute from the obj and do the dot product mask doesn't seem to behave like it should, Doesn't look like reading N but i don"t see any error in the following snippet, did i miss something?

Im under H19, py3:

-------------

 

string geo_mesh = 'op:/obj/geo_1_textures/OUT'; // geometry path
vector uv_tex = set(X, Y, 0.0); // texture space

// assign image textures to UV coordinates
vector tex_0 = colormap(tex_A, uv_tex);
vector tex_1 = colormap(tex_B, uv_tex);

vector N = uvsample(geo_mesh, 'N', 'uv', uv_tex); // transfer normal attributes from geo
float mask = clamp( dot(N, {0,1,0}), 0.0, 1.0); // create mask based on normals direction

mask= pow(mask,0.8);
vector tex_diff = lerp(tex_0, tex_1, mask); // blend textures dependent on mask

vector color = tex_diff; // assigns texture to color vector
assign(R, G, B, color); // color vector gets assigned to R, G and B color components

Share this post


Link to post
Share on other sites
43 minutes ago, vinyvince said:

do the dot product mask doesn't seem to behave like it should

Hi Vincent,

it seems to work on my side. Did you fill the image paths?

image.thumb.png.ad39747f85deaee788dcdfc66d6a8708.png

Share this post


Link to post
Share on other sites
Posted (edited)

Yes Konstantin.

It's just when i blur the normal or even add a noise to it, the mask doesn't seem to react.

Very basic but i can't get the proper mask in the the Cop snippet right...

Off course i can't get it in SOP, but i will rather like pixel than point :)

Edited by vinyvince

Share this post


Link to post
Share on other sites
Posted (edited)

Here thats working to import N

image.thumb.png.39b09c904331663f5f8ba0feca9d9b51.png

 

Edited by vinyvince

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×