File:Parametric surface illustration (torus).png

From Vigyanwiki

Original file(1,504 × 1,804 pixels, file size: 1.93 MB, MIME type: image/png)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Self-made with PlotOptiX package for ray tracing in Python.
Date
Source Own work
Author Rob su
Other versions other fields =
PNG genesis
InfoField
 This PNG graphic was created with Python

Licensing

I, the copyright holder of this work, hereby publish it under the following licence:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International licence.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the licence, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible licence as the original.

Source code (python)

import numpy as np

# docs, examples: https://plotoptix.rnd.team
from plotoptix import TkOptiX
from plotoptix.utils import make_color
from plotoptix.materials import m_plastic

def torus(u, v, r, R):
    x = r * np.sin(v)
    y = (R + r * np.cos(v)) * np.sin(u)
    z = (R + r * np.cos(v)) * np.cos(u)
    return np.array([x, y, z], dtype=np.float32)

r = (0, 2*np.pi)
n = 500

i = np.linspace(r[0], r[1], n)

U, V = np.meshgrid(i, i)
S = np.swapaxes(torus(U, V, 3, 5), 0, 2)

rt = TkOptiX(width=1500, height=1800)

rt.set_param(min_accumulation_step=2,
             max_accumulation_frames=500,
             light_shading="Hard")
rt.set_uint("path_seg_range", 6, 15)

rt.setup_material("plastic", m_plastic)

exposure = 0.8; gamma = 2.2
rt.set_float("tonemap_exposure", exposure)
rt.set_float("tonemap_gamma", gamma)
rt.add_postproc("Gamma")

rt.set_background(0)
rt.set_ambient(0.15)

rt.set_surface("surface", S, c=0.94, make_normals=True, mat="plastic")

rt.set_data("plane", geom="Parallelograms",
            pos=[[-100, -9, -100]], u=[200, 0, 0], v=[0, 0, 200],
            c=make_color([0.1, 0.2, 0.3], exposure=exposure, gamma=gamma))

rt.setup_camera("cam1", cam_type="DoF",
                eye=[-50, 5, -15], target=[0, 0, -1], up=[0, 1, 0],
                aperture_radius=0.4, aperture_fract=0.2,
                focal_scale=0.92, fov=32)

rt.setup_light("light1", pos=[-15, 20, 15], color=8, radius=6)

rt.start()

Captions

Add a one-line explanation of what this file represents
Torus, created with a parametric equation and ray traced in Python.

Items portrayed in this file

depicts

9 June 2019

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current14:04, 10 June 2019Thumbnail for version as of 14:04, 10 June 20191,504 × 1,804 (1.93 MB)wikimediacommons>Rob suUser created page with UploadWizard

The following page uses this file:

Metadata