- Viewports and Clipping (Direct3D 9)
- The Viewing Frustum
- Viewport Rectangle
- Clearing a Viewport
- Set Up the Viewport for Clipping
- 3ds Max
- Issue:
- Solution:
- See Also:
- 3ds Max: How to use viewport clipping
- Fixing the display of imported FBX / 3DS models
- Fixing partialy visible model
- So how it works?
- Usefull applications of the viewport clipping
- 3D-simply
- Меню навигации
- Пользовательские ссылки
- Информация о пользователе
- Вопрос по интерфейсу 3D’s Max 2009.
- Сообщений 1 страница 18 из 18
- Поделиться12011-08-30 19:48:48
- Поделиться22011-08-30 21:37:20
- Поделиться32011-08-30 22:16:46
- Поделиться42011-10-06 03:16:22
- Поделиться52011-10-06 09:24:00
- Поделиться62011-10-06 11:02:40
- Поделиться72011-10-07 03:10:30
Viewports and Clipping (Direct3D 9)
Conceptually, a viewport is a two-dimensional (2D) rectangle into which a 3D scene is projected. In Direct3D, the rectangle exists as coordinates within a Direct3D surface that the system uses as a rendering target. The projection transformation converts vertices into the coordinate system used for the viewport. A viewport is also used to specify the range of depth values on a render-target surface into which a scene will be rendered (usually 0.0 to 1.0).
The Viewing Frustum
A viewing frustum is 3D volume in a scene positioned relative to the viewport’s camera. The shape of the volume affects how models are projected from camera space onto the screen. The most common type of projection, a perspective projection, is responsible for making objects near the camera appear bigger than objects in the distance. For perspective viewing, the viewing frustum can be visualized as a pyramid, with the camera positioned at the tip as shown in the following illustration. This pyramid is intersected by a front and back clipping plane. The volume within the pyramid between the front and back clipping planes is the viewing frustum. Objects are visible only when they are in this volume.
If you imagine that you are standing in a dark room and looking through a square window, you are visualizing a viewing frustum. In this analogy, the near clipping plane is the window, and the back clipping plane is whatever finally interrupts your view — the skyscraper across the street, the mountains in the distance, or nothing at all. You can see everything inside the truncated pyramid that starts at the window and ends with whatever interrupts your view, and you can see nothing else.
The viewing frustum is defined by fov (field of view) and by the distances of the front and back clipping planes, specified in z-coordinates, as shown in the following diagram.
In this diagram, the variable D is the distance from the camera to the origin of the space that was defined in the last part of the geometry pipeline — the viewing transformation. This is the space around which you arrange the limits of your viewing frustum. For information about how this D variable is used to build the projection matrix, see the Projection Transform (Direct3D 9)
Viewport Rectangle
You define the viewport rectangle in C++ by using the D3DVIEWPORT9 structure. The D3DVIEWPORT9 structure is used with the following viewport manipulation methods exposed by the IDirect3DDevice9 interface.
The D3DVIEWPORT9 structure contains four members — X, Y, Width, Height — that define the area of the render-target surface into which a scene will be rendered. These values correspond to the destination rectangle, or viewport rectangle, as shown in the following diagram.
The values you specify for the X, Y, Width, Height members are screen coordinates relative to the upper-left corner of the render-target surface. The structure defines two additional members (MinZ and MaxZ) that indicate the depth-ranges into which the scene will be rendered.
Direct3D assumes that the viewport clipping volume ranges from -1.0 to 1.0 in X, and from 1.0 to -1.0 in Y. These were the settings used most often by applications in the past. You can adjust the viewport aspect ratio before clipping using the projection transform.
MinZ and MaxZ indicate the depth-ranges into which the scene will be rendered and are not used for clipping. Most applications will set these members to 0.0 and 1.0 to enable the system to render to the entire range of depth values in the depth buffer. In some cases, you can achieve special effects by using other depth ranges. For instance, to render a heads-up display in a game, you can set both values to 0.0 to force the system to render objects in a scene in the foreground, or you might set them both to 1.0 to render an object that should always be in the background.
The dimensions used in the X, Y, Width, Height members of the D3DVIEWPORT9 structure for a viewport define the location and dimensions of the viewport on the render-target surface. These values are in screen coordinates, relative to the upper-left corner of the surface.
Direct3D uses the viewport location and dimensions to scale the vertices to fit a rendered scene into the appropriate location on the target surface. Internally, Direct3D inserts these values into the following matrix that is applied to each vertex.
This matrix scales vertices according to the viewport dimensions and desired depth range and translates them to the appropriate location on the render-target surface. The matrix also flips the y-coordinate to reflect a screen origin at the top-left corner with y increasing downward. After this matrix is applied, vertices are still homogeneous — that is, they still exist as [x,y,z,w] vertices — and they must be converted to non-homogeneous coordinates before being sent to the rasterizer.
The viewport scaling matrix incorporates the MinZ and MaxZ members of the D3DVIEWPORT9 structure to scale vertices to fit the depth range [MinZ, MaxZ]. This represents different semantics from previous releases of DirectX, in which these members were used for clipping.
Applications typically set MinZ and MaxZ to 0.0 and 1.0 respectively to cause the system to render to the entire depth range. However, you can use other values to achieve certain affects. For example, you might set both values to 0.0 to force all objects into the foreground, or set both to 1.0 to render all objects into the background.
Clearing a Viewport
Clearing the viewport resets the contents of the viewport rectangle on the render-target surface. It can also clear the rectangle in the depth and stencil buffer surfaces.
Use IDirect3DDevice9::Clear to clear the viewport. The method accepts one or more rectangles that define the areas on the surface being cleared. Setting the Count parameter to 1, and the pRects parameter to the address of a single rectangle that covers the entire viewport area will clear the entire viewport. Another way to clear the entire viewport is to set the pRects parameter to NULL and the Count parameter to 0.
The IDirect3DDevice9::Clear can be used for clearing stencil bits within a depth buffer. Simply set the Flags parameter to determine how IDirect3DDevice9::Clear works with the render target and any associated depth or stencil buffers. The D3DCLEAR_TARGET flag will clear the viewport using an arbitrary RGBA color that you provide in the Color argument (this is not the material color). The D3DCLEAR_ZBUFFER flag will clear the depth buffer to an arbitrary depth you specify in Z: 0.0 is the closest distance, and 1.0 is the farthest. The D3DCLEAR_STENCIL flag will reset the stencil bits to the value you provide in the Stencil argument. You can use integers that range from 0 to 2n-1, where n is the stencil buffer bit depth.
In some situations, you might be rendering only to small portions of the render target and depth buffer surfaces. The clear methods also enable you to clear multiple areas of your surfaces in a single call. Do this by setting the Count parameter to the number of rectangles you want cleared, and specify the address of the first rectangle in an array of rectangles in the pRects parameter.
Set Up the Viewport for Clipping
The results of the projection matrix determine the clipping volume in projection space as:
Источник
3ds Max
By:
Issue:
When working with very small or very large elements in the Perspective Viewport in 3ds Max, you may encounter issues with Viewport clipping. The issue may be noticeable when the view is dollied in close to sub-object elements such as a Vertex or Edge.
Example workflow that would show issue is below:
- Object has been created in scene at very small unit size- for example, a new sphere has been created that is 5 units high. Object has been converted to Editable Poly object for edit- this can be done by selecting object and choosing Right-Click>Convert to>Editable Poly.
- With the object selected, Vertex Sub-object mode has been selected(1)
- In Perspective Viewport(P)- You have framed the Vertex by hitting ‘Zoom extents all selected’ or Z shortcut key.
Result: When framing the Sub-object, you may find that the Viewport is clipped and that the object is only partially visible. Orbiting(MMB) the Viewport you may see that elements closest to the view are hidden and you can see through the model. This can be seen in the screenshot below where the polygons at the rear of the sphere are visible because the polygons closest to the view are hidden:
Solution:
This issue is due to the default Viewport Clipping value set for the Perspective View. The system near clip value for the Viewport may cause elements closest to the view to be clipped.
The issue can be more easily illustrated when working with a standard Camera in 3ds Max. Cameras in 3ds Max include user modifiable settings for Clipping Planes > Near Clip and Far Clip. When set manually, the Clipping planes are visible as a red square in the Viewport. Objects that are closer to the camera than the Near Clip plane or further away from the Camera than the Far Clip plane will be clipped and invisible in the Viewport. This is illustrated in the screenshot below, the section of the small sphere nearest to the camera will be clipped, whilst the section of the large sphere farthest from the camera will also be clipped:
When working in a Perspective Viewport, the setting for Near and Far Clipping plane is modifiable through a slider that can be accessed from the Viewport label as shown below:
The sliders display as yellow triangles on the right of the Viewport. The triangle slider at the bottom of the screen is for Near plane clip whilst the triangle slider at the top of the Viewport is for Far plane clip. To resolve the issue in example above, you would need to reduce the value for near plane clip by dragging the slider at the bottom of the screen downwards.
If you are working with small scene elements and sub-objects and experiencing this issue regularly, you may also wish to consider scaling objects temporarily through an Xform modifier which will mean that the elements are more appropriately scaled for the system units you are working to.
See Also:
Further information on Unit Scaling and Viewport Clipping can be found in the 3ds Max documentation and glossary in the following sections:
- Autodesk 3ds Max Design Help > Customizing the User Interface > Units Setup Dialog
- Autodesk 3ds Max Design Help > Glossary > Clipping Planes
Источник
3ds Max: How to use viewport clipping
Fixing the display of imported FBX / 3DS models
Often when you import 3ds or fbx model of the building into 3ds Max, it looks distorted in the viewport. It usually happens when the model was exported from the ArchiCAD, Revit or other BIM applications. Although these glitches don’t affect the quality of rendering, they can be annoying while working on the model.
Imported 3ds/fbx model looks distorted in the 3ds Max’s viewport
Fortunately, it’s really easy to fix this issue — all you need is to activate 3ds Max’s viewport clipping and when clipping controls (yellow triangles) appears on the right side of the viewport, push the lower triangle slightly up until the model starts to look correctly:
Activation of 3ds Max clipping system
Fixing partialy visible model
Another issue can happen when working on really small details zoom in closely to the model — part of it can be cut off. In that case, you need to drag the lower triangle just a bit lower, until all parts of the model become visible.
Restore part of the model which have been cut off
So how it works?
Basically, it works the same as 3ds Max Free Camera clipping, but without a visual representation of the clipping planes and the ability to specify their distances numerically.
The lower triangle handle acts like the near clipping plane, and upper — as the far plane. Therefore, moving lower handle up pushes near the cut-off plane further away from you and cuts the elements closest to you. Similarly, when you drag the upper handle down, it cuts the elements behind the far cut-off plane. Here is an analogy with the Free camera:
Elements in front of and behind clipping planes have been cut off
Usefull applications of the viewport clipping
This feature also comes in handy if you want to do something inside the building, like to place furniture in the apartments on every floor. In BIM apps like ArchiCAD or Revit, you have direct access to the floorplan or section views, which are very convenient for such tasks.
To achieve similar functionality in the 3ds Max, switch to the «Top» view and drag the lower triangle up until you see the desired floor — now you can place or move the furniture on it with ease:
Emulation of the floor plan view in 3ds Max
The same goes for any orthographic view — you can access and work on the main model without the need to manually hide elements in front of it:
Emulation of the section view in 3ds Max
Hope this info was helpful and give you some ideas on how to improve your workflow!
Источник
3D-simply
Меню навигации
Пользовательские ссылки
Информация о пользователе
Вы здесь » 3D-simply » Интерфейс » Вопрос по интерфейсу 3D’s Max 2009.
Вопрос по интерфейсу 3D’s Max 2009.
Сообщений 1 страница 18 из 18
Поделиться12011-08-30 19:48:48
- Автор: MX
- Участник
- Зарегистрирован : 2011-08-30
- Приглашений: 0
- Сообщений: 15
- Уважение: [+0/-0]
- Провел на форуме:
3 часа 36 минут - Последний визит:
2011-09-28 12:26:24
У меня время от времени пропадают стрелки передвижения объекта (x,y,z). Еще точно также иногда получается что я могу двигать объект только по одной оси ординат. Приходиться переключатся на разные виды, чтобы можно было сдвинуть объект как надо. Конечно думаю что сам на тыркал чего-то, но хотелось бы узнать как это быстро исправить, может Hot-Key какой случайно цепляю.
Поделиться22011-08-30 21:37:20
- Автор: Dark Smiley
- Активный участник
- Откуда: Москва
- Зарегистрирован : 2011-08-30
- Приглашений: 0
- Сообщений: 34
- Уважение: [+1/-0]
- Пол: Мужской
- Возраст: 40 [1981-09-09]
- Провел на форуме:
9 часов 56 минут - Последний визит:
2012-02-02 03:07:04
Стрелки — gizmo клавиша X
Привязка по осям F8
Поделиться32011-08-30 22:16:46
- Автор: MX
- Участник
- Зарегистрирован : 2011-08-30
- Приглашений: 0
- Сообщений: 15
- Уважение: [+0/-0]
- Провел на форуме:
3 часа 36 минут - Последний визит:
2011-09-28 12:26:24
Мелочь а очень помогли. Спасибо
Поделиться42011-10-06 03:16:22
- Автор: tashaprim
- Активный участник
- Зарегистрирован : 2011-08-31
- Приглашений: 0
- Сообщений: 56
- Уважение: [+0/-0]
- Провел на форуме:
19 часов 58 минут - Последний визит:
2013-03-19 15:08:05
Всем привет!
У меня появились проблемы с программой во время курса Стаса.Раньше такого не было.
Макс 2009 Дизайн.
Если я каждый день открываю программу,работаю с проектом,то.
При следующем открытии программы возникает такая проблема: при открытии у нас есть новая пустая сцена.,если я просто начинаю строить,все в порядке.Но если я кликаю Опен или Опен Ресет,то сразу появляется окошко типа «файл был изменен,не хотите ли сохранить изменения». Если я нажму ОК,то сохраняется просто пустая сцена. Если я нажму Нет( раз я это уже сделала во время курса,о чем сильно пожалела. ),то потом при попытке открыть ужный мне файл через Опен или Опен Ресет я уже не смогла,он почему-то был с пустой сценой.
Вторая проблема. При более близком приближении сцены пропадают линии. Так я пытала сдвинуть гизмо плинтуса,когда делала комнату на курсе.
Вот так все пропадает.
И последний вопрос,а не проблема.Как настроить мышь.Хоть кручу колесико в одну сторону,картинка росто прыгает на шаг ближе — на шаг дальше — на шаг ближе — на шаг дальше.С трудом передвигается ближе или дальше.И представьте,что это происходит с наполненной сценой,котораю вообще тяжело двигать моему слабенькому ноуту.
Отредактировано tashaprim (2011-10-06 03:23:36)
Поделиться52011-10-06 09:24:00
- Автор: Nastenka
- Активный участник
- Откуда: Екатеринбург
- Зарегистрирован : 2011-08-31
- Приглашений: 0
- Сообщений: 170
- Уважение: [+0/-0]
- Пол: Женский
- Возраст: 36 [1985-01-13]
- Провел на форуме:
2 дня 6 часов - Последний визит:
2013-05-19 07:53:56
На счет последних двух вопросов могу ответить что есть такая кнопочка внизу — лупа
Поделиться62011-10-06 11:02:40
- Автор: tashaprim
- Активный участник
- Зарегистрирован : 2011-08-31
- Приглашений: 0
- Сообщений: 56
- Уважение: [+0/-0]
- Провел на форуме:
19 часов 58 минут - Последний визит:
2013-03-19 15:08:05
Настя,спасибо за ответ.
Но я конечно же использовала Зум,но линии все равно пропадают.
Что касается последнего вопроса,Зумом можно прекрасно ближе-дальше передвинуть,но меня интересует проблема именно с мышью,ведь раньше такого не наблюдалось.
Поделиться72011-10-07 03:10:30
- Автор: 3d_spline
- Активный участник
- Откуда: Санкт-Петербург
- Зарегистрирован : 2011-09-03
- Приглашений: 0
- Сообщений: 76
- Уважение: [+3/-0]
- Пол: Мужской
- Возраст: 44 [1977-01-30]
- Провел на форуме:
23 часа 51 минуту - Последний визит:
2012-07-25 11:32:42
Для начала полезно установить сервиспак, а затем все ХотФиксы отсюда http://usa.autodesk.com/adsk/servlet/ps … D=10381720.
Если ошибка с открыванием и Reset’ом сцены не разрешится, то тут виноват скорее всего какой-то плагин или скрипт макса (причем дополнительно установленный). Совсем-совсем это исправляется удалением макса со всеми плагинами, папок макса (которые в Program Files) и пользовательских настроек макса (у меня c:/Users/Имя пользователя/AppData/Local/Autodesk/3dsMaxDesign). Ну а дальше, ставим Макс со всеми сервиспаками и хотфиксами, Vray и лучше больше ничего к нему не устанавливать. Ситуация, когда какой-то плагин не от автодеска перестает работать после обновления макса или начинает мешать работать кому-то другому, очень распространена. Ну, а без Vray никак не обойтись.
Если не совсем радикально решать вопрос, то можно попробовать переименовать c:/Users/Имя пользователя/AppData/Local/Autodesk/3dsMaxDesign и запустить макс (он заново создаст эту папку). После чего нужно будет проверить, что все работает как надо и настроить заново интерфейс макса.
Еще можно попробовать отключить автобакап, перезапустить макс, и снова его включить.
Еще можно посмотреть, что написано в меню Edit про Undo (у меня там подсказка, какую последнюю операцию он будет отменять). Хитрость в том, что если после открытия макса сцена не пустая, то значит была проделана какая-то операция, и, возможно, про нее будет знать Undo (хотя не факт). Если там что-то есть, то это может помочь в понимании, что же происходит.
С увеличением мышей ситуация, как я понял забавная. Скорость увеличения колесом мыши зависит от приближенности к началу координат (вдали большая, в начале координат маленькая). У меня (макс дизайн 2012) скорость увеличения колесом мыши можно настроить в Customize->Preferences->Viewports Wheel Zoom Increment (чем выше число, тем резвее мышка, число можно делать 0,01). Только это, похоже, влияет и на скорость вращения сцены при движении мышой с зажатым Alt. В общем, лупа (Zoom) иногда спасает, когда мыша совсем становиться неудобной для поворотов-приближений сцены.
Источник