• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
fir

harder cases of triangle projection

11 posts in this topic

i was doing software rasterization of a triangle but i didnt do a harder cases of it

 

what do i mean harder cases - 

my 'camera' in the 3d world is like a 'pyramid' you konow what i mean - there is my eye at the 'top" of it and a rectangle of monitor screen on the 'bottom' -

hard case is when traingle crosses the monitor plane or even crosses the eye plane

or both, i do not know what to do in such cases

 

how do people do that 

 

1) if my triangle crosses the monitor plane should i cut the fragment and it will make some quad instead of triangle then draw it? Or should i magnify the crossed part (some rear part and only cut that when it crosses out the eye-monitor pyramid

 

is this code for such clipping hard ? im a bit lost in this probably

1

Share this post


Link to post
Share on other sites

Clipping against frustum planes is what you want, and the near plane is the most problematic one.

Do a search for triangle clipping against the near plane maybe.

Basically when a triangle intersects the near plane (either one or two of its vertices are behind the near plane) you will need to clip it and create either one or two new triangles to replace the old one.

If two points cross behind the plane will need to calculate two new points that lie on the plane using interpolation and create a new triangle using the vertex in the frustum and your two new verts. If one vertex is behind it, you will again need to make two new vertices on the plane but you will have to create two new triangles to account for the two vertices still left inside the frustum. Hope that made some kind of sense.

 

i wonder if in such clipping you need to talk about near plane at all..

wouldnt it be better just not define it and just calculate pure intersection of

pyramid vs triangle?

 

know what i mean something like

 

[attachment=22084:clip.JPG]

 

wouldnt it be better? has some one something to say about this or some code

example or something

0

Share this post


Link to post
Share on other sites

@up ye i know, i wrote about this cutted pyramid in the first post and about the uncutted in the second - those seem to be two aproaches one can use

 

it wold be nice if someone would say something more about them both* and some details

 

*seem that this cutted pyramid is at least more popular though the uncutted maybe may be better, im not sure

0

Share this post


Link to post
Share on other sites

 


it wold be nice if someone would say something more about them both* and some details

 

*seem that this cutted pyramid is at least more popular though the uncutted maybe may be better, im not sure

 

It's not a choice, the cut pyramid is correct, and the uncut pyramid is wrong.

You must have a near clipping plane, everything closer then the near clipping plane will misbehave, because math.

 

 

dont think so

 

imagine the pyramid (that is some fragment of 3d space) and imagine the triangle in any position it will be always corect to clip the triangle to the intersection fragment (and then cast it)

 

It seem to me better than near plane becouse with near plane youre clipping the triangle to some cutted thing (that do not exist in this 3d space) and then you show this cutted partial object (for example you can cut a ball to a half ball with near plane and than show this non existant halfball) - here with full pyrmid you always get correct (at least this seem to be like that for me)

0

Share this post


Link to post
Share on other sites

I disagree with Olof Hedman; there is a choice.

fir, you can choose to do it the way you're thinking of doing it, or you can choose to do it the correct way.

 

Use a "cut pyramid" (a frustum). This requires a near plane, so use a near plane.

 

I could probably link to some articles explaining why this way is correct, but you've stated your disgust with reading/searching/researching before, so I won't.

The short version is, like Olof Hedman says, math.

alright, 

 

but what with this math? - you can just count the intersection and you will get the clipping this is always possible though im not sure how hard or slow this is, maybe near plane is some optymalization shortcut ? *

 

* When using near plane clipping (which is probably relatively easy though as someone mention can transform a triangle into a quad (which then you probably easily can transform into two new triangles)) you can do such thing as projection then clipping in 2d (so you can omit the more computative 3d pyramid clipping)

The way Im talking is reverse order full 3d clipping then projection - so maybe this way is a harder one but i do not see still the reason why it may be strictly incorrect (as I said it do not makes cuts of the figures in visible space that may occur in the first way (though anyway im not sure if this cutting effect my be masked so player will never see this or this makes visible artifacts though)

Edited by fir
0

Share this post


Link to post
Share on other sites

 

The way Im talking is reverse order full 3d clipping then projection - so maybe this way is a harder one but i do not see still the reason why it may be strictly incorrect (as I said it do not makes cuts of the figures in visible space that may occur in the first way (though anyway im not sure if this cutting effect my be masked so player will never see this or this makes visible artifacts though)


It's incorrect because you can end up with a triangle that contains a vertex at the tip of the pyramid, which is a degenerate point. The tip of the pyramid is technically on the projection line of every single point in space. The reason for a near plane is to avoid that problem.

 

this is not any problem though - if so you just can treat that whole screen is in the color of this point of the triangle 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0