Jump to content

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,

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 2 years later...
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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...