3d,3dsmax , Safe frame calculation


Safe frame calculation

Question:

Tag: 3d,3dsmax

How safe frame is calculated in 3ds Max. I want to know the relationship between Viewport width and height, Render width and height(aspect ratio) in the calculation of safe frame width and height.

My final goal is to find the distance between top left corner of the plane and top left corner of the safe frame.

what I require is

enter image description here


Answer:

The following MAXScript function demonstrates how to calculate a box2 of the safe frame dimensions, given a point2 of the viewport size and the render size.

We need to account for two separate cases: one where the differences in aspect result in spacing on the left and right, and one where they result in spacing on the top and bottom.

fn getViewportSafeFrameSize viewSize renderSize =
(
    local viewAspect = viewSize.x as float / viewSize.y
    local renderAspect = renderSize.x as float / renderSize.y

    local x, y, w, h
    if (viewAspect > renderAspect) then
    (       
        h = viewSize.y
        w = (h * renderAspect) as integer
        y = 0
        x = (viewSize.x - w) / 2
    )
    else
    (
        w = viewSize.x
        h = (w / renderAspect) as integer
        x = 0
        y = (viewSize.y - h) / 2        
    )
    return box2 x y w h
)

--usage
getViewportSafeFrameSize [gw.getWinSizeX(), gw.getWinSizeY()] [renderWidth, renderHeight]

Related:


Creating A Cube Using Only CSS Gradients


html,css,graphics,3d,cube
I've tried numerous ways using linear-gradients to create several stripes layered on top of each other and have gotten very close but seem to be stuck on the top face. I'm trying to accomplish this using gradients be it linear or radial so that I can eventually upgrade them to...

How to check a point is inside an ellipsoid with orientation?


algorithm,3d,geometry,distance,computational-geometry
For an ellipsoid of the form with orientation vector and centre at point , how to find whether a point is inside the ellipsoid or not? An additional note that the geometry actually is with a=b (spheroid) and therefore one axis is sufficient to define orientation Note: I see a...

Safe frame calculation


3d,3dsmax
How safe frame is calculated in 3ds Max. I want to know the relationship between Viewport width and height, Render width and height(aspect ratio) in the calculation of safe frame width and height. My final goal is to find the distance between top left corner of the plane and top...

How do I plot a projection of 3D scatter data on the XY/XZ/YZ planes?


python,matplotlib,plot,3d
I have 4D data (3D scatter points + color) plotted using matplotlib's mplot3d library. To aid in parsing how the cloud of points is distributed in space, I'd like to show a projection of the cloud across each of the 3 planes (XY, XZ, YZ) using a 2D histogram/contour plot....

Clarification on Marching Cubes Algorithm


c++,algorithm,3d,marching-cubes
In regards of Marching Cubes, i have some doubts regarding its algorithm and implementation. I have gone through the excellent Paul Bourke article of Marching Cubes and also the available source code on the site, yet, i still encountered some problems in term of understanding as well as how to...

Basic Specular Shading


c++,graphics,3d
I am playing around with a simple code that generates a shaded sphere. I don't yet fully understand the math but I am figuring it out as I play with the code. I was wondering how one might implement specular shading into this based on this code. Any suggestions? for...

Why will my geometry not appear? (jMonkeyEngine)


java,3d,jmonkeyengine
I'm just now picking up jMonkeyEngine and I've encountered an issue I can't seem to solve. In the simpleInitApp method in the main class, I can use the following code to successfully render a box: Box playerBase = new Box(Vector3f.ZERO,1f,1f,1f); Geometry playerBaseGeom = new Geometry("playerBase", playerBase); Transform fixBaseHeight = new...

Blending between an N-sided shape and a perfect circle with the same origin?


python,3d
I'm currently writing a 3D shader for a computer program, and I've run into a bit of a problem I'm hoping someone can help me with. The shader is designed to generate an N-sided shape in 2D space. The 3D program that drives the shader essentially passes you a set...

DirectX 9 projection matrix infinite element?


c++,graphics,3d,directx-9
I've been banging my head on doing transformations in DirectX 9 and during debugging I finally noticed a problem, when calling D3DXMatrixPerspectiveFovLH(&projection, D3DX_PI/4, yRes/xRes, 1, 100); the first element (_11) of projection is #INF, which I'm pretty sure it should not be. This is directly after declaring this matrix and...

Pygame 3D: How to and is it possible?


python,performance,dictionary,3d,pygame
So I want to program a 3d-mesh viewer in pygame, no other 3rd-party modules wanted (panda3d is perfect, but it's very complicated). My idea is: list_of_surfs = {'85 50':'70deg'} #the 85 50 and the dimensions of the #side/surf, and 70 deg of rotation to be able to see it, then...

How to “add” two Triangle Meshes together in javafx?


javafx,3d,javafx-8,javafx-3d
I am making a 3D model of the volume generated by two functions: one as the base (in intersection of the x-axis), and the other as the height of the volume.This is achieved by approximating the volume of small parts, drawing that mesh, then adding all of the meshes together....

Draw a sphere on a billboard with world normal from a pointlist


3d,directx,shader,hlsl
I am drawing spheres on billboards by passing center world positions via a StructuredBuffer and use the geometry shader to build a billboard facing the camera. The sphere is drawn correctly and I can figure out the UVs. Now I would like to light it but I cannot figure how...

Best way to drag 3D point in 3D space with mouse picking in OpenGL?


c++,opengl,3d,drag-and-drop,mouse-picking
What is the best way to drag 3D point with mouse picking. Issue is not the picking but to dragging in 3D space. There are two ways I am thinking, one is to get the View to World coordinates using gluUnProject and translate the 3D point. The problem in this...

3D Lines disappear sometimes


javascript,d3.js,3d,three.js
I am building 3d line chart from data here is the code Demo the part of code that generate line is parentTransform = new THREE.Object3D(); var _color = d3.scale.category10(); for (var i = 5; i > 0; i--) { var material = new THREE.LineBasicMaterial({ // color: 0x0000ff,linewidth: 30 color: _color(i),...

Cannot create volume from Image3D function in Mathematica


arrays,image-processing,multidimensional-array,3d,wolfram-mathematica
I'm getting an error when using Image3D function of mathematica. I am trying to use that function to create a 3D volume from the array imagevar, which contains 10 grayscale binary images. images = FileNames["*.png"]; count = 1; Do[imagevar[count++] = Import[image], {image, images}] Image3D[imagevar[]] Whenever I run it, it returns...

OpenGl view matrix - wrong “camera” orientation and position


opengl,3d,camera
The symptom is, that the "position of the camera" seems to be mirrored around the x axis (negative z instead of positive z) and the "orientation of the camera" is opposing to the expected. In other words, I have to rotate the camera by 180 degrees and move it forwards...

MATLAB: How to make camera light follow 3D Rotation


matlab,user-interface,3d,rotation,lighting
I have come into a problem recently when trying to rotate 3D objects. I am building a GUI and I have a separate figure where an object is plotted. In the figure, I allow the user to use MATLAB's built-in rotate button to move the object around. However, I am...

Create a formula for velocity based on rotation in 3d?


math,3d,rotation,velocity
So I have a bit of a math problem. Here are the pieces. Input: Rot = Rotation (degrees). This is the rotation of the "player". This is also the yaw. Vel.X = This is the left/rightward movement that would be happening if it weren't rotated Vel.Z = Same as last...

R scatterplot3d turn x axis text 45°


r,text,3d,axis,scatter-plot
I have something like this, and want to turn xlabels 45 degrees (it is going to be rather long text): a<-c(1:10) b<-c(1:10) c<-c(1:10) scatterplot3d(a,b,c, main="3-D Scatterplot",color="blue", pch=19, type="h", lty.hplot=2, box=F, scale.y=.5, lty.grid=1, lab=c(9,5,1), xlab="", ylab="", zlab="") ...

Matlab plot3 movie where the colour of each point varies depending on arbitrary vector


matlab,plot,colors,3d,movie
I have a set of data arrays that are nx6, where the 1st 3 columns are the x, y, z coordinates of a trajectory and n varies. I have written a script in matlab that allows me to plot each point in succession and then make it into a movie,...

How to setup camera to point at object


ios,3d,scenekit
In my app I load models from different files (format is the same) and they have different geometry: big, small, wide, etc. I have object and camera position hard coded and for some cases I don't see anything because camera not point to object. Maybe there is a way to...

Plotting a 3D Cylindrical Surface plot in Python


python,matplotlib,plot,3d,surface
I am trying to create a cylindrical 3D surface plot using Python, where my independent variables are z and theta, and the dependent variable is radius (i.e., radius is a function of vertical position and azimuth angle). So far, I have only been able to find ways to create a...

WhirlyGlobe Sample for android not working


android,opengl-es,3d
I have tried whirlyglobe sample code but it didn't work, can you check and make it working for android. " MapGlobeTestFragment " this one "fragment class" is missing for android sample and its not present in library.

Plotting a imshow() image in 3d in matplotlib


python,matplotlib,3d
How to plot a imshow() image in 3d axes? I was trying with this post. In that post, the surface plot looks same as imshow() plot but actually they are not. To demonstrate, here I took different data: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np...

Why osgviewer works while osgDB::readImageFile() fails?


3d,openscenegraph
I'm new to OpenSceneGraph, and now I met a problem. When trying out a simple skybox program, it gives Warning: Could not find plugin to read objects from file "xxx.jpg" when calling osgDB::readImageFile(), and I can only see a white screen; Then I tried using osgviewer --image xxx.jpg in cmd,...

How to apply flat shading to RGB colors?


graphics,colors,3d,rgb
I am creating a small 3d rendering application. I decided to use simple flat shading for my triangles - just calculate the cosine of angle between face normal and light source and scale light intensity by it. But I'm not sure about how exactly should I apply that shading coefficient...

Make Camera LookDirection look front face


c#,wpf,3d,camera
How to look at the front of 3D Model in WPF? I am confused to set X Y Z for LookDirection. I don't know what happens when I set xyz and I don't know where camera is looking at. I don't know the same thing for UpDirection. Below is my...

how to create a 3D height map in python


python,matplotlib,plot,3d,surface
I have a 2D array Z that stores the height at that element's position. Other than using the method here in which I need to create array X and Y with the same size as Z, are there any simpler methods to create a 3D height map? The 3D surface...

OpenGL cube not being rendered


c++,opengl,3d
I'm struggling to get a cube to render in opengl. When I pass in the MVP already calculated to the vertex shader it works fine, but when I pass in the model, view and projection then do the calculation in the vertex shader it doesn't show the cube. I'm also...

JavaFX 8 Transform to pitch, yaw and roll rotation angles


matrix,3d,rotation,javafx-8
Implementing the answer from this thread I have this code that translates the deltayaw, deltaroll and deltapitch angles into one angle and rotates a node around it. The angles that are taken as the parameters are momentary changes of angles since giving the whole angles would ignore the changes in...

How to make 3D histogram in R


r,plot,3d,histogram
This is my goal: Plot the frequency of y according to x in the z axis. These are my problems: I have a two columns array (x and y) and need to divide x into classes (p.ex. 0.2 ou 0.5) and calculate the frequency of y for each class of...

Converting 2D images to 3D


python,r,3d
I was trying to convert 2D images to 3D by rotating them about the axes (like a circle to a sphere). Currently my problem is that suppose I have two functions f(x) and g(x) both in one variable. I wish to make a plot of the functions and use rotation...

Bid Rent Curves - Plotting Circles of Projected Radii from Another Dimension


r,plot,3d
The goal is to reproduce this Bid-Rent graph in R: The challenge is to draw the projected circles. So far I got: The 2D part is created by the R code below with the traditional graphic system in base R: #Distance X <- seq(0,7,1) #Bid Rent Curves: Commercial, Industrial, Residential...

Transforming surface normal vectors and tangent vectors


opengl,math,3d
According to a book Physically Based Rendering: From Theory to Implementation. By Matt Pharr, Greg Humphreys (link, p. 86-87), surface tangent vectors are transformed as common vectors, using transformation matrix M, but surface normal vectors are transformed using . I wonder why scaling does make a normal incorrect, but doesn't...

DirectX 9 not rendering after adding transforms


c++,3d,directx,direct3d,directx-9
so far I got a cube rendered without any transforms (thus it was rendered in an orthographic perspective), and I am working on the previous code to get it into a perspective view, with all the matrices involved. I changed the Flexible Vertex Format so as not to have RHW...

JavaFX 3D TriangleMesh with transparency


javafx,3d,transparency,transparent,javafx-3d
I have a texture I want to use for a TriangleMesh (it's a simple cube). Some parts of the texture are transparent. When I put the texture on the mesh, it's black. Is there a possibility to change that? I would like to make it transparent. Appreciate your help, thanks...

plotting points in 3d surface using x,y,z coordinates


3d,gnuplot
I need to plot some points in 3d surface based on x,y,z coordiantes values in a file named as test.dat test.dat file contains At-No X Y Z 6 3.532210 -2.171743 0.921140 7 1.164869 -1.418981 0.782133 1 2.454732 2.332989 -0.907213 6 -3.246376 -1.047325 -0.602590 6 -2.620684 0.053348 -0.013310 6 -4.569969 -1.249720...

Finding 3D coordinate of object


opencv,image-processing,3d,camera-calibration
I try to find 3D coordinate (in world )of abject that I know his coordinate in image .so after some research in internet I succed to find X and Y cordinate. but I can't find Z that is my program in openCV void drawAndCalcul3D(int x,int y,Mat& frame) { cv::Mat uvPoint...

Why translating matrix on Z axis is not the same as changing position on the Z axis by same number?


math,matrix,3d,three.js
I have a mesh that has origin point at the bottom. I want to move it by -132 on Z axis. If I change the position of the Mesh it is on the correct position. But If I translate it on the Z axis by -132, the mesh is off...

What's the use of lightmap?


graphics,unity3d,3d,game-engine
For starter, I know what a lightmap is, what to be gained by using it, and how to implement it. What I don't get is, if you have dynamically moving objects, which won't be able to generate a lightmap, you still need a light source to project their shadows. So,...

Is there any easy way to rotate an image about z axis using java without jumping into java 3d?


java,3d,image-rotation
I want to rotate an image about the z axis using java. I tried to search for ways to do that but it involves complex matrix manipulations and it works on 3d models and stuff. I will resort to that if there is no other way but would like to...

creating a 3d array in python does not create array correctly


python,arrays,3d
I wish to make a 3d array by appending each element to the array in a loop, but instead of getting a 3d array I just get a 1d array with more elements in it. I'm working in Python 2.7 I want to get labels = [1,34,u'te],[2,44,u've],[4,43,u'ht] My code so...

gluUnProject gives flippped y position


opengl,3d,coordinate-systems
I have set up openGL, so that the origin is at the top left corner. However, using gluUnProject to convert mouse coordinates to OpenGL coordinates, still gives me coordinates where the origin is at the bottom left corner and I am not sure why that is. So, OpenGL is setup...

How to calculate the distance from all points in a 3d matrix to a plane in matlab?


matlab,matrix,3d
This question is from my last post, But I will just focus on a particular part, If I have a 3d matrix M, 256*256*124,and a plane defined by 3 points that intersect the 3d matrix, A,B,C, how to find the distance of all points in M to the plane defined...

How to calculate a random point inside a cube


math,vector,3d,cube
I'm trying to figure out the math to find a random point inside a cube. I have something small but it can't take into account the rotation of the cube. Here are some images of my results. Here you can see the cube is rotated to some degree but when...

Fast Quaternion-Vector Multiplication with other Transformation Matrices


math,matrix,3d,quaternions,rotational-matrices
I am currently trying to find an equivalent for the following equation: vec_res = inverse(VM) * (q * (VM * vec_input) * conjugate(q)) where VM is a standard view matrix , q is a normalized quaternion, and vec_input a vector. In the form: vec_res = A * vec_input; or vec_res...

finger position using leap motion


python-2.7,3d,leap-motion
i want to use Leap Motion to get my Index finger Tip position in the space ( 3D position X,Y,Z ) , how can i do that in leap motion ? this is what i do only to detect index finger, but there an error : def on_frame(self, controller): #...

Unity WebPlayer “Failed to initialize player's 3D settings”?


web,unity3d,3d,augmented-reality,unity-web-player
I am trying to execute one of Daqri's AR demos, but I keep getting "Failed to initialize player's 3D settings" ...error every time I try to run the demo (Which is essentially a webpage). I am using unity 5.0.0f4 and even 4.5.3f3 (As a tried to implement a fix that...

Displaying surface with non-rectangular boundary


matlab,image-processing,plot,3d,surface
Refer to the attached image. I want to display the image in Matlab using the function surf(). However, I only want to display the region of the actual object without the background (the pale-green region surrounding the actual object which has 0 value). How to do that? I tried replacing...