Notifications
Clear all

[Closed] Barycentric point

Hello,

Let’s suppose I have a mesh composed of a single face (triangle).

Using barycentric coordinates, how can I change the colour of a point inside the triangle?

Right now I know how to change the colour of each of the vertexes that form the triangle, but I need to be able access and change more information.

Thank you.

15 Replies

What do you mean by “point inside the triangle” ?

If there is no vertex inside this triangle (which is then not a triangle, but three triangles) you cannot change its color (Pure logic). Only vertices, faces and edges can store color information.

Hello Groucho, thanks for your reply.

By “point” I mean anything inside the triangle that can be accesed by barycentric coordinates using the three vertexes that define the triangle.

For example, I can assign one colour to each vertex. But how can I assign a different colour to the middle (the barycentric centre) of the triangle?

For example, how can I make the triangle have two different colours? Like half white half black divided by an imaginary line defined by barycentric coordinates.

For example, I want to apply a procedural texture written by me, without using the material editor. Using only the information provided by the vertexes, this doesn’t look good.

nope – you would have to refine your mesh (or, in theory, the CPV data – but I’m not sure that actually works)

As far as I know, you cannot modify the way two colors interpolate from one vertex to another along a given edge. It is always a linear interpolation so that at the middle of the edge, the color is 50% mix between vertex A and vertex B.

Or, to put it another way, the “point” doesn’t exist until render time / viewport render time. It’s an artefact of the render pipeline.

Maybe with Nurbs you can access precisely a given point on a NURBS surface, voxel like.

So let me get this straight…

If I have a huge mesh plane consisting of only two faces (the two triangles), I cannot WRITE a procedural texture to make it have a chess board texture, or to make it have all the colours of the rainbow, or whatever procedural texture I want. Right? I have to go to the Material Editor and work in a non-script related manner?

Thanks again

That is correct. The only way to do what you want would be to refine your mesh (e.g. via the Tesselate modifier) and then affect vertices from there. But you’re going to end up with a looooooooooot of vertices.

If you want a programmable shader, wait for 2010 which has the mental mill thing going on, or find somebody to recompile MaxShade (it’s in SourceForge)… it had a renderman-like shading language support for textures… anything, including the scanline renderer, would render those. Tad slow, tho’.

In the end, you may have to learn C++ and get down and dirty with the 3ds Max SDK

Of course you can create, modify and apply materials using MAXscript only, without accessing the Material editor, but what we are telling you is that you cannot act directly on the geometry, you must use maps to apply on your object.

theMaterial = standard "myMaterial" 
 theMaterial.shadertype = 1 -- Blinn shader
 theMaterial.diffusemap = checker
 
 myPlane.material = theMaterial
Page 1 / 2