Home Technical Talk

How to cap low poly cylinders

Hi, I'm trying to cap a cylinder in a proper way, avoiding the triangles around 1 single point, as I heard that it's not proper for exporting to a real time engine.

But as I see in the epic content, in UDK, they don't look too much to the "quad rule", so I'm quite confused about this.

The thing is that in my case I have to model a boiler shape, so i need to add the minimum of polys to create that curved shape and help to the normal maps.

I'm thinking on 2 ways of doing this, I attach samples.
The hole is not very important (because is hidden by a pipe).

cylindercap.jpg

cylindercaphole.jpg

Replies

  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    Real time engines only work with triangles, you don't need to do this at all, your first version of the cylinder will work fine.

    Most of the time people keep quads because it's easier to work with, or when working on base-meshes that will be exported to a sculpting app (like Zbrush or Mudbox), as quads subdivide more cleanly than triangles.
  • styx
    Options
    Offline / Send Message
    I'm not talking about the issues for the workflow, I meant the issues derived from the order the realtime engine render the polygons.
    Here there is an explanation about this, in the paragraph "the stripping process":
    http://www.ericchadwick.com/examples/provost/byf2.html

    But curiously the people of epic don't follow this rules at all.
    My question is, is it really important in UDK engine?

    The thing here is, Is better adding more polygons and helping the engine to render? or saving polygons making tris around a vertice?
  • Mark Dygert
    Options
    Offline / Send Message
    I agree do whatever is easiest to work with. Your bottom example would be a pain for me to work with because I like loops and rings.

    Also... Quad Cap?
    http://www.mariussilaghi.com/qcap.htm
  • mdeforge
  • DOG-GY
    Options
    Offline / Send Message
    DOG-GY polycounter lvl 12
    I've always tried to quadrify caps as best I can and tend to stick to side counts that can make all quad caps, but that was never even introduced as a method in the thread you link to Stradigos. Sure it's all triangulated at runtime but I don't see many disadvantages to the "all/near all quads" method.

    Anyone care to elaborate?
  • hamzaaa
    Options
    Offline / Send Message
    hamzaaa polycounter lvl 11
    Holy crap this quad cap scripts looks amazing!
  • styx
    Options
    Offline / Send Message
    Thank you all for the info. That script is really good. Stradigos thank you for the link that things are really what I wanted to know about.

    But even with that I still have doubts about my model, because in this case is not a cylinder at all, because it's not flat on the top. So the only options I can think on are the ones I showed you.

    I think I'd choose my second option (only 6 tris more, but I think it does worth it).

    Do you know any other proper options for my case?
  • mdeforge
    Options
    Offline / Send Message
    mdeforge polycounter lvl 14
    I would look at this thread for ideas on how to close that better.

    http://www.polycount.com/forum/showthread.php?t=56014

    The first page has some good examples, but really the whole thread is worth the read.
  • Fingus
    Options
    Offline / Send Message
    Fingus polycounter lvl 11
    Unless you're doing work for iPhone or other platforms with really low hardware specs you probably won't have to worry about vertex splits or triangle stripping for your optimization. Todays hardware is so powerful you have a huge resource ceiling to work with. Don't take my word for it because I'm not that well versed in the deep technical side of things, but I'm pretty sure that the benefit from this is such a minor change in comparison to textures or overall polycount. This article is pretty old and talks about optimizing for a few generations back, note that textures he's talking about are in the range of 64 to 256.

    By the way, if I'm talking out of my ass feel free to call me out on it. I just haven't ever run across instances where this has been a big concern.
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    I have a dirty 8-sided-hole cap script you can use if you like.
    fn caphole _obj=
    (
         --polyop.getVertsUsingEdge <Poly poly> <edgelist>
         max modify mode
         subobjectLevel = 3
         edgesel = polyop.getEdgeSelection _obj
    
         if (edgesel as array).count>0 then
         (
             thefaces = #{1..(polyop.getnumfaces _obj)}
             firstedge = (edgesel as array)[1]
             --get border from edge to make sure border is complete.
             borderedges = polyop.getBorderFromEdge _obj firstedge
    
    		 --we only work on 8 sided borders for now, so opt out if not:
    		 if (borderedges as array).count == 8 then
    		 (
    			 --we will cap the border in order to get the vert indices ___order__
    			 (polyop.capHolesByEdge _obj borderedges)
    			
    			 --get the new face's ID
    			 thecapface =( (#{1..(polyop.getnumfaces _obj)})-thefaces) as array
    
    			 if thecapface.count == 1 then 
    			 (	 
    				 thecapface = thecapface[1]
    
    				 --format "the capface seems to be this index: %\n" thecapface
    				 
    				--get the face verts in the appropriate order
    				 vert_order = polyop.getFaceVerts _obj thecapface
    				
    				 --remove the leftover face
    				 polyop.deleteFaces _obj #(thecapface)
    
    				 borderverts = vert_order
    
    				 --#########################
    				 --for p = 1 to borderverts.count do (format "%\n" borderverts[p])
    				 --#########################
    
    				 --get average pos of verts
    				 avpos = [0,0,0]
    				 for vi = 1 to borderverts.count do
    				 (
    					 thisv = polyop.getvert _obj (borderverts[vi])
    					 avpos = avpos + thisv
    				 )
    				 avpos = avpos*1.0/borderverts.count
    
    				 --make centre vert
    				 middlevert = polyop.createVert _obj avpos
    
    				 pfaceids = #()
    
    				--build vertex id sets to build from
    				 for vf = 0 to 3 do
    				 (
    					 face_list_tmp =#()
    					 --format "doing a face\n"
    					 for v = (vf*2+1) to (vf*2+3) do
    					 (
    						 theindex = v
    						 if theindex > borderverts.count then theindex = (mod theindex borderverts.count)
    						 --format "\t%\n" theindex
    						 append face_list_tmp (borderverts[theindex])
    					 )
    					 append pfaceids face_list_tmp
    				 )
    				
    				--build faces
    				 for face_build = 1 to pfaceids.count do
    				 (
    					 --format "building face %\n" face_build
    					 thevs = pfaceids[face_build]
    					 append thevs middlevert
    					 for fvb = 1 to thevs.count do
    					 (
    						 --format "\t%\n" thevs[fvb]
    					 )
    					 --build one face
    					 polyop.createPolygon _obj thevs
    				 )
    			 )
    		 )
         )
    )
    
    caphole (selection[1])
    
  • styx
    Options
    Offline / Send Message
    Thanks for the link Stradigos but this is more for subdivision modelling in High Poly. What I'm looking for is to model the Lowpoly optimized for running in a game engine. I'm interested to know the best way to optimize like if it were for a mobile or so as fingus is saying.

    Cw thanks for the script, interesting thing, but it's not quite useful for me as I don't need speed here, it doesn't take too long time to cap a hole like this. I just want to know the best way to do it.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    You're making this too complicated for no reason, everyone pretty much answered it, just weld the points if you don't need the flat top and you're done, no need to torture yourself on this point (pun intended).

    There is no best way to do it, it all depends on the budget of your polies, how close the piece is to your character, if it's a main/hero piece or not, will it be mainly faked with the normal map or not, etc.

    For now, almost everyone will agree you should just point it off, easiest and most straight solution (pun intended) but if show us the whole piece (like a gun the player will carry for example and the can iron-sight aim with it) than we would tell you to increase the overall polies to give it more curve and quad the end.

    But honestly, even then I point you to the pointing (pun intended).
  • styx
    Options
    Offline / Send Message
    Well I think there is always a best way.. taking into the account everything of course.

    Yeah probably you are making a good point pointing to the point ;), and in most of the cases I agree that is better not to be very anal, because it affects to the speed of your workflow, and it's not worth.

    You've pointed to other important thing that I didn't consider at all, the visibility. Obviusly if it's not very close or frecuently hidden because of the camera angle, those triangles are not gonna make too much harm..
    So thanks for the info, and your point :)
Sign In or Register to comment.