Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/04/2023 in all areas

  1. I just want to mention that you have to be very careful with these sorts of scripts when dealing with non-planar quad polygons that may be present and selected. For example, consider the following view through a Parallel Camera (to minimize perspective distortion) being used as the Viewport camera: The magenta diagonal line is a guide that goes from Point 0 to Point 3, representing how this non-planar quad is presently being triangulated by Cinema 4D. The yellow line segment emanating from the center (actually through the center, sort of, since it starts quite a ways below the surface of the quad at what Cinema 4D considers to be the center point of this quad) represents what Cinema considers to be the polygon's normal, with Polygon Normals enabled for display in the Viewport (and shown via Preferences at a 400% scale, so that they are long enough to be "legible"). Similar yellow line segments going through the corner points of the polygon, added in via creative use of a Matrix object (and the little originally white cubes at the vertices that it thinks it is aligning!), overlay a copy of the polygon normal at each point, so that it can be compared with the light gray vertex normals coming up from each point, as rendered by Cinema 4D, since Vertex Normals are also enabled for the Viewport. In addition to all of the above, the point indices are also displayed to label the individual vertices, courtesy of the aforementioned Matrix object. I should also note that there is a slight discrepancy between the direction of the Z Modeling Axis and the quad normal, as displayed. Active tool info: Move Tool in Polygon mode with the Modeling Axis set to Selected/Axis and all else default. This is not a figment of your imagination and this is noticeable regardless of whether the Viewport is using a Perspective camera or a Parallel camera. They are truly pointing in slightly different directions and I don't know which of the two is "correct." Here are the point coordinates making up the sole Polygon of the polygonal object (uncreatively) named nonplanar_quad, as shown via the Structure Manager: Finally, here is what the Python script, quoted from the above post, produces as the polygon's normal for the Polygon comprising our nonplanar_quad object, along with additional data describing the point properties of the object and its sole polygon, as retrieved via the usual Cinema 4D Python API member functions called on the object: The resulting normalized unit-vector (last line of output, above) lacks a Z directional component, even though Cinema's interpretation (via those yellow normal line segments and their leftward tilt in the view) is clearly showing that Cinema 4D thinks a Z component should be present in the polygon normal. The cause of the difference is that the quoted script only uses Polygon points a, b, and c, to calculate the cross-product of rays ba and cb as the polygon's normal. For this non-planar case, polygon point d is also playing a role in what Cinema 4D considers to be the polygon's "true" normal. Of course we are not dealing with a quadrangle or polygon in the mathematical sense here, since it is non-planar, but it can be argued that the (averaged) normal for this non-planar quad should take into account the individual normals of both of the planar triangles from which it is constructed.
    2 points
  2. The selection is not meant for interactive use but with modeling operations or for the creation of selection tags, the example scene does both.
    1 point
  3. Hello, I like to share my new Cinema 4D Tutorial. How to use Cinema 4D Pyro with Chaos Corona
    1 point
  4. Open c4d Open the preferences Click the button at the bottom This takes you to the location for c4ds prefs and caches Close c4d Uninstall c4d Delete everything you see in the folder you left open from before Reinstall c4d
    1 point
  5. The short answer is, "yes." Many gemstones have complex IOR values. In particular, gemstones with a single IOR>=1.65 have highly complex refractive IOR values that differ for different wavelengths, viewing angles, changes in density based on impurities in the stone, etc. In fact, the single real-world dispersion value, which takes complex IORs at different wavelengths into account, is often touted about (e.g., Abbe value) is just an approximation either based on a single wavelength of light, usually tied to a particular Fraunhofer line (e.g., nD based on the Sodium-D line), or a chart across two such lines, referred to as the the differences in IOR between two pre-defined Fraunhofer lines (e.g., B and G lines) at their respective wavelengths. For your specific case of blood, you can see a graph of the refractive index (eta) and extinction coefficient (kappa) at various wavelengths, at: https://refractiveindex.info/?shelf=other&book=blood&page=Rowe ..., a good site for getting complex IOR curves for various materials.
    1 point
  6. Here is a python solution. Enjoy 🙂 It also works with multiple polygons selected with different normals. It will select all the polygons that match any of the normals in the initial selection. import c4d def getNormal(poly, points): a = poly.a b = poly.b c = poly.c d = poly.d a_pos = points[a] b_pos = points[b] c_pos = points[c] vector1 = a_pos-b_pos vector2 = b_pos-c_pos normal = vector1.Cross(vector2) normal.Normalize() return str(normal) def main(): doc.StartUndo() obj = doc.GetActiveObject() polys = obj.GetAllPolygons() points = obj.GetAllPoints() poly_sel = obj.GetPolygonS() indices = poly_sel.GetAll(len(polys)) selected = [i for i, selected in enumerate(indices) if selected] selected_normals = {getNormal(polys[index], points) for index in selected} for i, poly in enumerate(polys): normal = getNormal(poly, points) if normal in selected_normals: doc.AddUndo(c4d.UNDOTYPE_CHANGE_SELECTION, obj) poly_sel.Select(i) doc.EndUndo() c4d.EventAdd() if __name__ == '__main__': main() select_similar_normals.py
    1 point
×
×
  • Create New...