7/31/2019 Obj Format
1/51
B1.ObjectFiles(.obj)
ObjectfilesdefinethegeometryandotherpropertiesforobjectsinWavefront'sAdvancedVisualizer.ObjectfilescanalsobeusedtotransfergeometricdatabackandforthbetweentheAdvancedVisualizerandotherapplications.
ObjectfilescanbeinASCIIformat(.obj)orbinaryformat(.mod).ThisappendixdescribestheASCIIformatforobjectfiles.Thesefilesmusthavetheextension.obj.
Inthisrelease,the.objfileformatsupportsbothpolygonalobjectsandfree-formobjects.Polygonalgeometryusespoints,lines,andfacestodefineobjectswhilefree-formgeometryusescurvesandsurfaces.
Aboutthissection
The.objappendixisforthosewhowanttousethe.objformattotranslategeometricdatafromothersoftwareapplicationstoWavefrontproducts.ItalsoprovidesinformationforAdvancedVisualizeruserswhowantdetailedinformationontheWavefront.objfileformat.
Ifyouarea2.11userandwanttounderstandthesignificanceofthe3.0releaseandhowitaffectsyourexistingfiles,youmaybe
especiallyinterestedinthesectioncalled"Supersededstatements"attheendoftheappendix.Thesection,"Patchesandfree-formsurfaces,"givesexamplesofhow2.11patcheslookin3.0.
Howthissectionisorganized
Mostofthisappendixdescribesthedifferentpartsofan.objfileandhowthosepartsarearrangedinthefile.Thethreesectionsattheendoftheappendixprovidebackgroundinformationonthe3.0releaseofthe.objformat.
The.objappendixincludesthefollowingsections:
oFilestructure
oGeneralstatement
oVertexdata
oSpecifyingfree-formcurves/surfaces
oFree-formcurve/surfaceattributes
oElements
oFree-formcurve/surfacebodystatements
oConnectivitybetweenfree-formsurfaces
oGrouping
oDisplay/renderattributes
oComments
oMathematicsforfree-formcurves/surfaces
7/31/2019 Obj Format
2/51
oSupersededstatements
oPatchesandfree-formsurfaces
---------------
Thecurveandsurfaceextensionstothe.objfileformatweredevelopedinconjunctionwithmentalimagesGmbH&Co.KG,Berlin,Germany,aspartofajointdevelopmentprojecttoincorporatefree-formsurfacesintoWavefront'sAdvancedVisualizer.
Filestructure
Thefollowingtypesofdatamaybeincludedinan.objfile.Inthislist,thekeyword(inparentheses)followsthedatatype.
Vertexdata
ogeometricvertices(v)
otexturevertices(vt)
overtexnormals(vn)
oparameterspacevertices(vp)Free-formcurve/surfaceattributes
orationalornon-rationalformsofcurveorsurfacetype:basismatrix,Bezier,B-spline,Cardinal,Taylor(cstype)
odegree(deg)
obasismatrix(bmat)
ostepsize(step)
Elements
opoint(p)
oline(l)
oface(f)
ocurve(curv)
o2Dcurve(curv2)
osurface(surf)
Free-formcurve/surfacebodystatements
oparametervalues(parm)
ooutertrimmingloop(trim)
oinnertrimmingloop(hole)
ospecialcurve(scrv)
7/31/2019 Obj Format
3/51
ospecialpoint(sp)
oendstatement(end)
Connectivitybetweenfree-formsurfaces
oconnect(con)
Grouping
ogroupname(g)
osmoothinggroup(s)
omerginggroup(mg)
oobjectname(o)
Display/renderattributes
obevelinterpolation(bevel)
ocolorinterpolation(c_interp)
odissolveinterpolation(d_interp)
olevelofdetail(lod)
omaterialname(usemtl)
omateriallibrary(mtllib)
oshadowcasting(shadow_obj)
oraytracing(trace_obj)
ocurveapproximationtechnique(ctech)
osurfaceapproximationtechnique(stech)
Thefollowingdiagramshowshowthesepartsfittogetherinatypical.objfile.
FigureB1-1.Typical.objfilestructure
Generalstatement
callfilename.extarg1arg2...
Readsthecontentsofthespecified.objor.modfileatthislocation.Thecallstatementcanbeinsertedinto.objfilesusingatexteditor.
filename.extisthenameofthe.objor.modfiletoberead.Youmustincludetheextensionwiththefilename.
arg1arg2...specifiesaseriesofoptionalintegerarguments
7/31/2019 Obj Format
4/51
thatarepassedtothecalledfile.Thereisnolimittothenumberofnestedcallsthatcanbemade.
ArgumentspassedtothecalledfilearesubstitutedinthesamewayasinUNIXscripts;forexample,$1inthecalledfileisreplacedbyarg1,$2inthecalledfileisreplacedbyarg2,andsoon.
Iftheframenumberisneededinthecalledfileforvariablesubstitution,"$1"mustbeusedasthefirstargumentinthecallstatement.Forexample:
callfilename.obj$1
Thenthestatementinthecalledfile,
scmpfilename.pv$1
willworkasexpected.Formoreinformationonthescmpstatement,seeappendixC,VariableSubstitutionformoreinformation.
Anothermethodtodothesamethingis:
scmpfilename.pv$1
callfilename.obj
Usingthismethod,thescmpstatementprovidesthe.pvfileforallsubsequentlycalled.objor.modfiles.
cshcommand
csh-command
ExecutestherequestedUNIXcommand.IftheUNIXcommandreturnsanerror,theparserflagsanerrorduringparsing.
Ifadash(-)precedestheUNIXcommand,theerrorisignored.
commandistheUNIXcommand.
Vertexdata
Vertexdataprovidescoordinatesfor:
ogeometricvertices
otexturevertices
overtexnormals
Forfree-formobjects,thevertexdataalsoprovides:
oparameterspacevertices
Thevertexdataisrepresentedbyfourvertexlists;oneforeachtypeofvertexcoordinate.Aright-handcoordinatesystemisusedtospecifythecoordinatelocations.
Thefollowingsampleisaportionofan.objfilethatcontainsthefourtypesofvertexinformation.
7/31/2019 Obj Format
5/51
v-5.0000005.0000000.000000v-5.000000-5.0000000.000000v5.000000-5.0000000.000000v5.0000005.0000000.000000vt-5.0000005.0000000.000000vt-5.000000-5.0000000.000000vt5.000000-5.0000000.000000vt5.0000005.0000000.000000vn0.0000000.0000001.000000vn0.0000000.0000001.000000vn0.0000000.0000001.000000vn0.0000000.0000001.000000vp0.2100003.590000vp0.0000000.000000vp1.0000000.000000vp0.5000000.500000
WhenverticesareloadedintotheAdvancedVisualizer,theyaresequentiallynumbered,startingwith1.Thesereferencenumbersareusedinelementstatements.
Syntax
Thefollowingsyntaxstatementsarelistedinorderofcomplexity.
vxyzw
Polygonalandfree-formgeometrystatement.
Specifiesageometricvertexanditsxyzcoordinates.Rationalcurvesandsurfacesrequireafourthhomogeneouscoordinate,alsocalledtheweight.
xyzarethex,y,andzcoordinatesforthevertex.Theseare
floatingpointnumbersthatdefinethepositionofthevertexinthreedimensions.
wistheweightrequiredforrationalcurvesandsurfaces.Itisnotrequiredfornon-rationalcurvesandsurfaces.Ifyoudonotspecifyavalueforw,thedefaultis1.0.
NOTE:Apositiveweightvalueisrecommended.Usingzeroornegativevaluesmayresultinanundefinedpointinacurveorsurface.
vpuvw
Free-formgeometrystatement.
Specifiesapointintheparameterspaceofacurveorsurface.
Theusagedetermineshowmanycoordinatesarerequired.Specialpointsforcurvesrequirea1Dcontrolpoint(uonly)intheparameterspaceofthecurve.Specialpointsforsurfacesrequirea2Dpoint(uandv)intheparameterspaceofthesurface.Controlpointsfornon-rationaltrimmingcurvesrequireuandvcoordinates.Controlpointsforrationaltrimmingcurvesrequireu,
7/31/2019 Obj Format
6/51
v,andw(weight)coordinates.
uisthepointintheparameterspaceofacurveorthefirstcoordinateintheparameterspaceofasurface.
visthesecondcoordinateintheparameterspaceofasurface.
wistheweightrequiredforrationaltrimmingcurves.Ifyoudonotspecifyavalueforw,itdefaultsto1.0.
NOTE:Foradditionalinformationonparametervertices,seethecurv2andspstatements
vnijk
Polygonalandfree-formgeometrystatement.
Specifiesanormalvectorwithcomponentsi,j,andk.
Vertexnormalsaffectthesmooth-shadingandrenderingofgeometry.Forpolygons,vertexnormalsareusedinplaceoftheactualfacetnormals.Forsurfaces,vertexnormalsareinterpolatedovertheentiresurfaceandreplacetheactualanalyticsurfacenormal.
Whenvertexnormalsarepresent,theysupersedesmoothinggroups.
ijkarethei,j,andkcoordinatesforthevertexnormal.Theyarefloatingpointnumbers.
vtuvw
Vertexstatementforbothpolygonalandfree-formgeometry.
Specifiesatexturevertexanditscoordinates.A1Dtexturerequiresonlyutexturecoordinates,a2Dtexturerequiresbothuandvtexturecoordinates,anda3Dtexturerequiresallthreecoordinates.
uisthevalueforthehorizontaldirectionofthetexture.
visanoptionalargument.
visthevaluefortheverticaldirectionofthetexture.Thedefaultis0.
wisanoptionalargument.
wisavalueforthedepthofthetexture.Thedefaultis0.
Specifyingfree-formcurves/surfaces
Therearethreestepsinvolvedinspecifyingafree-formcurveorsurfaceelement.
oSpecifythetypeofcurveorsurface(basismatrix,Bezier,B-spline,Cardinal,orTaylor)usingfree-formcurve/surfaceattributes.
oDescribethecurveorsurfacewithelementstatements.
7/31/2019 Obj Format
7/51
oSupplyadditionalinformation,usingfree-formcurve/surfacebodystatements
Thenextthreesectionsofthisappendixprovidedetailedinformationoneachofthesesteps.
Datarequirementsforcurvesandsurfaces
Allcurvesandsurfacesrequireacertainsetofdata.Thisconsistsofthefollowing:
Free-formcurve/surfaceattributes
oAllcurvesandsurfacesrequiretypedata,whichisgivenwiththecstypestatement.
oAllcurvesandsurfacesrequiredegreedata,whichisgivenwiththedegstatement.
oBasismatrixcurvesorsurfacesrequireabmatstatement.
oBasismatrixcurvesorsurfacesalsorequireastepsize,whichisgivenwiththestepstatement.
Elements
oAllcurvesandsurfacesrequirecontrolpoints,whicharereferencedinthecurv,curv2,orsurfstatements.
o3Dcurvesandsurfacesrequireaparameterrange,whichisgiveninthecurvandsurfstatements,respectively.
Free-formcurve/surfacebodystatements
oAllcurvesandsurfacesrequireasetofglobalparametersoraknotvector,bothofwhicharegivenwiththeparmstatement.
oAllcurvesandsurfacesbodystatementsrequireanexplicitendstatement.
Errorchecks
Theabovesetofdatastartsoutemptywithnodefaultvalueswhenreadingofan.objfilebegins.Whilethefileisbeingread,statementsareencountered,informationisaccumulated,andsomeerrorsmaybereported.
Whentheendstatementisencountered,thefollowingerrorchecks,whichinvolveconsistencybetweenvariousstatements,areperformed:
oAllrequiredinformationispresent.
oThenumberofcontrolpoints,numberofparametervalues(knots),anddegreeareconsistentwiththecurveorsurfacetype.Ifthetypeisbmatrix,thestepsizeisalsoconsistent.(Formoreinformation,refertotheparametervectorequationsinthesection,"Mathematicsoffree-formcurves/surfaces"attheendofappendixB1.)
oIfthetypeisbmatrixandthedegreeisn,thesizeofthe
7/31/2019 Obj Format
8/51
basismatrixis(n+1)x(n+1).
Notethatanyinformationgivenbythestate-settingstatementsremainsineffectfromonecurveorsurfacetothenext.Informationgivenwithinacurveorsurfacebodyisonlyeffectiveforthecurveorsurfaceitisgivenwith.
Free-formcurve/surfaceattributes
Fivetypesoffree-formgeometryareavailableinthe.objfileformat:
oBezier
obasismatrix
oB-spline
oCardinal
oTaylor
Youcanapplythesetypesonlytocurvesandsurfaces.Eachofthesefivetypescanberationalornon-rational.
Inadditiontospecifyingthetype,youmustdefinethedegreeforthecurveorsurface.Forbasismatrixcurveandsurfaceelements,youmustalsospecifythebasismatrixandstepsize.
Allfree-formcurveandsurfaceattributestatementsarestate-setting.Thismeansthatonceanattributestatementisset,itappliestoallelementsthatfollowuntilitisresettoadifferentvalue.
Syntax
Thefollowingsyntaxstatementsarelistedinorderofuse.
cstyperattype
Free-formgeometrystatement.
Specifiesthetypeofcurveorsurfaceandindicatesarationalornon-rationalform.
ratisanoptionalargument.
ratspecifiesarationalformforthecurveorsurfacetype.Ifratisnotincluded,thecurveorsurfaceisnon-rational
typespecifiesthecurveorsurfacetype.Allowedtypesare:
bmatrix basismatrix
bezier Bezier
bspline B-spline
cardinalCardinal
7/31/2019 Obj Format
9/51
taylor Taylor
Thereisnodefault.Avaluemustbesupplied.
degdegudegv
Free-formgeometrystatement.
Setsthepolynomialdegreeforcurvesandsurfaces.
deguisthedegreeintheudirection.Itisrequiredforbothcurvesandsurfaces.
degvisthedegreeinthevdirection.Itisrequiredonlyforsurfaces.ForBezier,B-spline,Taylor,andbasismatrix,thereisnodefault;avaluemustbesupplied.ForCardinal,thedegreeisalways3.IfsomeothervalueisgivenforCardinal,itwillbeignored.
bmatumatrix
bmatvmatrix
Free-formgeometrystatement.
Setsthebasismatricesusedforbasismatrixcurvesandsurfaces.Theuandvvaluesmustbespecifiedinseparatebmatstatements.
NOTE:Thedegstatementmustbegivenbeforethebmatstatementsandthesizeofthematrixmustbeappropriateforthedegree.
uspecifiesthatthebasismatrixisappliedintheudirection.
vspecifiesthatthebasismatrixisappliedinthevdirection.
matrixliststhecontentsofthebasismatrixwithcolumnsubscript
jvaryingthefastest.Ifnisthedegreeinthegivenuorvdirection,thematrix(i,j)shouldbeofsize(n+1)x(n+1).
Thereisnodefault.Avaluemustbesupplied.
NOTE:Thearrangementofthematrixisdifferentfromthatcommonlyfoundinotherreferences.Formoreinformation,seetheexamplesattheendofthissectionandalsothesection,"Mathematicsforfree-formcurvesandsurfaces."
stepstepustepv
Free-formgeometrystatement.
Setsthestepsizeforcurvesandsurfacesthatuseabasismatrix.
stepuisthestepsizeintheudirection.Itisrequiredforbothcurvesandsurfacesthatuseabasismatrix.
stepvisthestepsizeinthevdirection.Itisrequiredonlyforsurfacesthatuseabasismatrix.Thereisnodefault.Avaluemustbesupplied.
7/31/2019 Obj Format
10/51
Whenacurveorsurfaceisbeingevaluatedandatransitionfromonesegmentorpatchtothenextoccurs,thesetofcontrolpointsusedisincrementedbythestepsize.Theappropriatestepsizedependsontherepresentationtype,whichisexpressedthroughthebasismatrix,andonthedegree.
Thatis,supposewearegivenacurvewithkcontrolpoints:{v,...v}1k
Ifthecurveisofdegreen,thenn+1controlpointsareneededforeachpolynomialsegment.Ifthestepsizeisgivenass,thentheithpolynomialsegment,wherei=0isthefirstsegment,willusethecontrolpoints:
{v,...,v}is+1is+n+1
Forexample,forBeziercurves,s=n.
Forsurfaces,theabovedescriptionappliesindependentlytoeachparametricdirection.
Whenyoucreateafilewhichusesthebasismatrixtype,besureto
specifyastepsizeappropriateforthecurrentcurveorsurfacerepresentation.
Examples
1.CubicBeziersurfacemadewithabasismatrix
TocreateacubicBeziersurface:
cstypebmatrixdeg33step33bmatu1-33-1\
03-63\003-3\0001
bmatv1-33-1\03-63\003-3\0001
2.Hermitecurvemadewithabasismatrix
TocreateaHermitecurve:
cstypebmatrix
deg3step2bmatu10-32003-2\
01-2100-11
3.BezierinudirectionwithB-splineinvdirection;madewithabasismatrix
TocreateasurfacewithacubicBezierintheudirectionandcubicuniformB-splineinthevdirection:
7/31/2019 Obj Format
11/51
cstypebmatrixdeg33step31bmatu1-33-1\
03-63\003-3\0001
bmatv0.16666-0.500000.50000-0.16666\0.666660.00000-1.000000.50000\0.166660.500000.50000-0.50000\0.000000.000000.000000.16666
Elements
Forpolygonalgeometry,theelementtypesavailableinthe.objfileare:
opoints
olines
ofaces
Forfree-formgeometry,theelementtypesavailableinthe.objfileare:
ocurve
o2Dcurveonasurface
osurface
Allelementscanbefreelyintermixedinthefile.
Referencingvertexdata
Forallelements,referencenumbersareusedtoidentifygeometricvertices,texturevertices,vertexnormals,andparameterspacevertices.
Eachofthesetypesofverticesisnumberedseparately,startingwith1.Thismeansthatthefirstgeometricvertexinthefileis1,thesecondis2,andsoon.Thefirsttexturevertexinthefileis1,thesecondis2,andsoon.Thenumberingcontinuessequentiallythroughouttheentirefile.Frequently,fileshavemultiplelistsofvertexdata.Thisnumberingsequencecontinuesevenwhenvertexdataisseparatedbyotherdata.
Inadditiontocountingverticesdownfromthetopofthefirstlistinthefile,youcanalsocountverticesbackupthelistfromanelement'spositioninthefile.Whenyoucountupthelistfromanelement,thereferencenumbersarenegative.Areferencenumberof-1indicatestheverteximmediatelyabovetheelement.Areferencenumberof-2indicatestworeferencesaboveandsoon.
Referencinggroupsofvertices
7/31/2019 Obj Format
12/51
Someelements,suchasfacesandsurfaces,mayhaveatripletofnumbersthatreferencevertexdata.Thesenumbersarethereferencenumbersforageometricvertex,atexturevertex,andavertexnormal.
Eachtripletofnumbersspecifiesageometricvertex,texturevertex,andvertexnormal.Thereferencenumbersmustbeinorderandmustseparatedbyslashes(/).
oThefirstreferencenumberisthegeometricvertex.
oThesecondreferencenumberisthetexturevertex.Itfollowsthefirstslash.
oThethirdreferencenumberisthevertexnormal.Itfollowsthesecondslash.
Thereisnospacebetweennumbersandtheslashes.Theremaybemorethanoneseriesofgeometricvertex/texturevertex/vertexnormalnumbersonaline.
Thefollowingisaportionofasamplefileforafour-sidedfaceelement:
f1/1/12/2/23/3/34/4/4
Usingv,vt,andvntorepresentgeometricvertices,texturevertices,andvertexnormals,thestatementwouldread:
fv/vt/vnv/vt/vnv/vt/vnv/vt/vn
Ifthereareonlyverticesandvertexnormalsforafaceelement(notexturevertices),youwouldentertwoslashes(//).Forexample,tospecifyonlythevertexandvertexnormalreferencenumbers,youwouldenter:
f1//12//23//34//4
Whenyouareusingaseriesoftriplets,youmustbeconsistentinthewayyoureferencethevertexdata.Forexample,itisillegaltogivevertexnormalsforsomevertices,butnotall.
Thefollowingisanexampleofanillegalstatement.
f1/1/12/2/23//34//4
Syntax
Thefollowingsyntaxstatementsarelistedinorderofcomplexityofgeometry.
pv1v2v3...
Polygonalgeometrystatement.
Specifiesapointelementanditsvertex.Youcanspecifymultiplepointswiththisstatement.Althoughpointscannotbeshadedorrendered,theyareusedbyotherAdvancedVisualizerprograms.
visthevertexreferencenumberforapointelement.Eachpointelementrequiresonevertex.Positivevaluesindicateabsolute
7/31/2019 Obj Format
13/51
vertexnumbers.Negativevaluesindicaterelativevertexnumbers.
lv1/vt1v2/vt2v3/vt3...
Polygonalgeometrystatement.
Specifiesalineanditsvertexreferencenumbers.Youcanoptionallyincludethetexturevertexreferencenumbers.Althoughlinescannotbeshadedorrendered,theyareusedbyotherAdvancedVisualizerprograms.
Thereferencenumbersfortheverticesandtextureverticesmustbeseparatedbyaslash(/).Thereisnospacebetweenthenumberandtheslash.
visareferencenumberforavertexontheline.Aminimumoftwovertexnumbersarerequired.Thereisnolimitonthemaximum.Positivevaluesindicateabsolutevertexnumbers.Negativevaluesindicaterelativevertexnumbers.
vtisanoptionalargument.
vtisthereferencenumberforatexturevertexinthelineelement.Itmustalwaysfollowthefirstslash.
fv1/vt1/vn1v2/vt2/vn2v3/vt3/vn3...
Polygonalgeometrystatement.
Specifiesafaceelementanditsvertexreferencenumber.Youcanoptionallyincludethetexturevertexandvertexnormalreferencenumbers.
Thereferencenumbersforthevertices,texturevertices,andvertexnormalsmustbeseparatedbyslashes(/).Thereisnospacebetweenthenumberandtheslash.
visthereferencenumberforavertexinthefaceelement.Aminimumofthreeverticesarerequired.
vtisanoptionalargument.
vtisthereferencenumberforatexturevertexinthefaceelement.Italwaysfollowsthefirstslash.
vnisanoptionalargument.
vnisthereferencenumberforavertexnormalinthefaceelement.Itmustalwaysfollowthesecondslash.
Faceelementsusesurfacenormalstoindicatetheirorientation.Ifverticesareorderedcounterclockwisearoundtheface,boththefaceandthenormalwillpointtowardtheviewer.Ifthevertexorderingisclockwise,bothwillpointawayfromtheviewer.Ifvertexnormalsareassigned,theyshouldpointinthegeneraldirectionofthesurfacenormal,otherwiseunpredictableresultsmayoccur.
Ifafacehasatexturemapassignedtoitandnotextureverticesareassignedinthefstatement,thetexturemapisignoredwhen
7/31/2019 Obj Format
14/51
theelementisrendered.
NOTE:Anyreferencestofo(faceoutline)arenolongervalidasofversion2.11.Youcanusef(face)togetthesameresults.Referencestofoinexisting.objfileswillstillberead,however,theywillbewrittenoutasfwhenthefileissaved.
curvu0u1v1v2...
Elementstatementforfree-formgeometry.
Specifiesacurve,itsparameterrange,anditscontrolvertices.Althoughcurvescannotbeshadedorrendered,theyareusedbyotherAdvancedVisualizerprograms.
u0isthestartingparametervalueforthecurve.Thisisafloatingpointnumber.
u1istheendingparametervalueforthecurve.Thisisafloatingpointnumber.
visthevertexreferencenumberforacontrolpoint.Youcanspecifymultiplecontrolpoints.Aminimumoftwocontrolpointsarerequiredforacurve.
Foranon-rationalcurve,thecontrolpointsmustbe3D.Forarationalcurve,thecontrolpointsare3Dor4D.Thefourthcoordinate(weight)defaultsto1.0ifomitted.
curv2vp1vp2vp3...
Free-formgeometrystatement.
Specifiesa2Dcurveonasurfaceanditscontrolpoints.A2Dcurveisusedasanouterorinnertrimmingcurve,asaspecialcurve,orforconnectivity.
vpistheparametervertexreferencenumberforthecontrolpoint.Youcanspecifymultiplecontrolpoints.Aminimumoftwocontrolpointsisrequiredfora2Dcurve.
Thecontrolpointsareparameterverticesbecausethecurvemustlieintheparameterspaceofsomesurface.Foranon-rationalcurve,thecontrolverticescanbe2D.Forarationalcurve,thecontrolverticescanbe2Dor3D.Thethirdcoordinate(weight)defaultsto1.0ifomitted.
surfs0s1t0t1v1/vt1/vn1v2/vt2/vn2...
Elementstatementforfree-formgeometry.
Specifiesasurface,itsparameterrange,anditscontrolvertices.Thesurfaceisevaluatedwithintheglobalparameterrangefroms0tos1intheudirectionandt0tot1inthevdirection.
s0isthestartingparametervalueforthesurfaceintheudirection.
s1istheendingparametervalueforthesurfaceintheudirection.
7/31/2019 Obj Format
15/51
t0isthestartingparametervalueforthesurfaceinthevdirection.
t1istheendingparametervalueforthesurfaceinthevdirection.
visthereferencenumberforacontrolvertexinthesurface.
vtisanoptionalargument.
vtisthereferencenumberforatexturevertexinthesurface.Itmustalwaysfollowthefirstslash.
vnisanoptionalargument.
vnisthereferencenumberforavertexnormalinthesurface.Itmustalwaysfollowthesecondslash.
Foranon-rationalsurface,thecontrolverticesare3D.Forarationalsurfacethecontrolverticescanbe3Dor4D.Thefourthcoordinate(weight)defaultsto1.0ifommitted.
NOTE:Formoreinformationontheorderingofcontrolpointsfor
survaces,refertothesectiononsurfacesandcontrolpointsin"mathematicsoffree-formcurves/surfaces"attheendofthisappendix.
Examples
Theseareexamplesforpolygonalgeometry.
Forexamplesusingfree-formgeometry,seetheexamplesattheendofthenextsection,"Free-formcurve/surfacebodystatements."
1. Square
Thisexampleshowsasquarethatmeasurestwounitsoneachsideandfacesinthepositivedirection(towardthecamera).Notethattheorderingoftheverticesiscounterclockwise.Thisorderingdeterminesthatthesquareisfacingforward.
v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000f1234
2.Cube
Thisisacubethatmeasurestwounitsoneachside.Eachvertexissharedbythreedifferentfaces.
v0.0000002.0000002.000000v0.0000000.0000002.000000v2.0000000.0000002.000000v2.0000002.0000002.000000
7/31/2019 Obj Format
16/51
v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000f1234f8765f4378f5148f5621f2673
3.Cubewithnegativereferencenumbers
Thisisacubewithnegativevertexreferencenumbers.Eachelementreferencestheverticesstoredimmediatelyaboveitinthefile.Notethatverticesarenotshared.
v0.0000002.0000002.000000v0.0000000.0000002.000000v2.0000000.0000002.000000v2.0000002.0000002.000000f-4-3-2-1
v2.0000002.0000000.000000
v2.0000000.0000000.000000v0.0000000.0000000.000000v0.0000002.0000000.000000f-4-3-2-1
v2.0000002.0000002.000000v2.0000000.0000002.000000v2.0000000.0000000.000000v2.0000002.0000000.000000f-4-3-2-1
v0.0000002.0000000.000000v0.0000002.0000002.000000
v2.0000002.0000002.000000v2.0000002.0000000.000000f-4-3-2-1
v0.0000002.0000000.000000v0.0000000.0000000.000000v0.0000000.0000002.000000v0.0000002.0000002.000000f-4-3-2-1
v0.0000000.0000002.000000v0.0000000.0000000.000000v2.0000000.0000000.000000
v2.0000000.0000002.000000f-4-3-2-1
Free-formcurve/surfacebodystatements
Youcanspecifyadditionalinformationforfree-formcurveandsurfaceelementsusingaseriesofstatementscalledbodystatements.Theseriesisconcludedbyanendstatement.
7/31/2019 Obj Format
17/51
Bodystatementsarevalidonlywhentheyappearbetweenthefree-formelementstatement(curv,curv2,surf)andtheendstatement.Iftheyareanywhereelseinthe.objfile,theydonothaveanyeffect.
Youcanusebodystatementstospecifythefollowingvalues:
oparameter
oknotvector
otrimmingloop
ohole
ospecialcurve
ospecialpoint
Youcannotuseanyotherstatementsbetweenthefree-formcurveorsurfacestatementandtheendstatement.Usinganyotheroftypeofstatementmaycauseunpredictableresults.
Thisportionofasamplefileshowstheknotvectorvaluesfora
rationalB-splinesurfacewithatrimmingloop.Noticetheendstatementtoconcludethebodystatements.
cstyperatbsplinedeg22surf-1.02.5-2.02.0-9-8-7-6-5-4-3-2-1parmu-1.00-1.00-1.002.502.502.50parmv-2.00-2.00-2.00-2.00-2.00-2.00trim0.02.01end
Parametervaluesandknotvectors
Allcurveandsurfaceelementsrequireasetofparametervalues.
Forpolynomialcurvesandsurfaces,thisspecifiesglobalparametervalues.ForB-splinecurvesandsurfaces,thisspecifiestheknotvectors.
Forsurfaces,theparametervaluesmustbespecifiedforboththeuandvdirections.Forcurves,theparametervaluesmustbespecifiedforonlytheudirection.
Ifmultipleparametervaluestatementsforthesameparametricdirectionareusedinsideasinglecurveorsurfacebody,thelaststatementisused.
Trimmingloopsandholes
Thetrimmingloopstatementbuildsasingleoutertrimmingloopasasequenceofcurveswhichlieonagivensurface.
Theholestatementbuildsasingleinnertrimmingloopasasequenceofcurveswhichlieonagivensurface.Theinnerloopcreatesahole.
Thecurvesarereferencedbynumberinthesamewayverticesare
7/31/2019 Obj Format
18/51
referencedbyfaceelements.
Theindividualcurvesmustlieend-to-endtoformaclosedloopwhichdoesnotintersectitselfandwhichlieswithintheparameterrangespecifiedforthesurface.Theloopasawholemaybeorientedineitherdirection(clockwiseorcounterclockwise).
Tocutoneormoreholesinaregion,useatrimstatementfollowedbyoneormoreholestatements.Tointroduceanothertrimmedregioninthesamesurface,useanothertrimstatementfollowedbyoneormoreholestatements.Theorderingthatassociatesholesandtheregionstheycutisimportantandmustbemaintained.
Ifthefirsttrimstatementinthesequenceisomitted,theenclosingoutertrimmingloopistakentobetheparameterrangeofthesurface.Ifnotrimorholestatementsarespecified,thenthesurfaceistrimmedatitsparameterrange.
Thisportionofasamplefileshowsanon-rationalBeziersurfacewithtworegions,eachwithasinglehole:
cstypebezierdeg11surf0.02.00.02.01234
parmu0.002.00parmv0.002.00trim0.04.01hole0.04.02trim0.04.03hole0.04.04end
Specialcurve
Aspecialcurvestatementbuildsasinglespecialcurveasasequenceofcurveswhichlieonagivensurface.
Thecurvesarereferencedbynumberinthesamewayverticesarereferencedbyfaceelements.
Aspecialcurveisguaranteedtobeincludedinanytriangulationofthesurface.Thismeansthatthelineformedbyapproximatingthespecialcurvewithasequenceofstraightlinesegmentswillactuallyappearasasequenceoftriangleedgesinthefinaltriangulation.
Specialpoint
Aspecialpointstatementspecifiesthatspecialgeometricpointsaretobeassociatedwithacurveorsurface.Forspacecurvesandtrimmingcurves,theparameterverticesmustbe1D.Forsurfaces,theparameter
verticesmustbe2D.
Thesespecialpointswillbeincludedinanylinearapproximationofthecurveorsurface.
Forspacecurves,thismeansthatthepointcorrespondingtothegivencurveparameterisincludedasoneoftheverticesinanapproximationconsistingofasequenceoflinesegments.
Forsurfaces,thismeansthatthepointcorrespondingtothegiven
7/31/2019 Obj Format
19/51
7/31/2019 Obj Format
20/51
holeu0u1curv2du0u1curv2d...
Bodystatementforfree-formgeometry.
Specifiesasequenceofcurvestobuildasingleinnertrimmingloop(hole).
u0isthestartingparametervalueforthetrimmingcurvecurv2d.
u1istheendingparametervalueforthetrimmingcurvecurv2d.
curv2distheindexofthetrimmingcurvelyingintheparameterspaceofthesurface.Thiscurvemusthavebeenpreviouslydefinedwiththecurv2statement.
scrvu0u1curv2du0u1curv2d...
Bodystatementforfree-formgeometry.
Specifiesasequenceofcurveswhichlieonthegivensurfacetobuildasinglespecialcurve.
u0isthestartingparametervalueforthespecialcurvecurv2d.
u1istheendingparametervalueforthespecialcurvecurv2d.
curv2distheindexofthespecialcurvelyingintheparameterspaceofthesurface.Thiscurvemusthavebeenpreviouslydefinedwiththecurv2statement.
spvp1vp...
Bodystatementforfree-formgeometry.
Specifiesspecialgeometricpointstobeassociatedwithacurveorsurface.Forspacecurvesandtrimmingcurves,theparameter
verticesmustbe1D.Forsurfaces,theparameterverticesmustbe2D.
vpisthereferencenumberfortheparametervertexofaspecialpointtobeassociatedwiththeparameterspacepointofthecurveorsurface.
end
Bodystatementforfree-formgeometry.
Specifiestheendofacurveorsurfacebodybegunbyacurv,curv2,orsurfstatement.
Examples
1.Taylorcurve
Forcreatingasingle-segmentTaylorpolynomialcurveoftheform:
234x=3.00+2.30t+7.98t+8.30t+6.34t
7/31/2019 Obj Format
21/51
234y=1.00-10.10t+5.40t-4.70t+2.03t
234z=-2.50+0.50t-7.00t+18.10t+0.08t
andevaluatedbetweentheglobalparameters0.5and1.6:
v3.0001.000-2.500v2.300-10.1000.500v7.9805.400-7.000v8.300-4.70018.100v6.3402.0300.080cstypetaylordeg4curv0.5001.60012345parmu0.0002.000end
2.Beziercurve
Thisexampleshowsanon-rationalBeziercurvewith13controlpoints.
v-2.3000001.9500000.000000v-2.2000000.7900000.000000v-2.340000-1.5100000.000000v-1.530000-1.4900000.000000v-0.720000-1.4700000.000000v-0.7800000.2300000.000000v0.0700000.2500000.000000v0.9200000.2700000.000000v0.800000-1.6100000.000000v1.620000-1.5900000.000000v2.440000-1.5700000.000000v2.6900000.6700000.000000v2.9000001.9800000.000000
#13vertices
cstypebezierctechcparm1.000000deg3curv0.0000004.00000012345678910\111213parmu0.0000001.0000002.0000003.000000\4.000000end#1element
3.B-splinesurface
ThisisanexampleofacubicB-splinesurface.
gbspatchv-5.000000-5.000000-7.808327v-5.000000-1.666667-7.808327v-5.0000001.666667-7.808327v-5.0000005.000000-7.808327
7/31/2019 Obj Format
22/51
v-1.666667-5.000000-7.808327v-1.666667-1.66666711.977780v-1.6666671.66666711.977780v-1.6666675.000000-7.808327v1.666667-5.000000-7.808327v1.666667-1.66666711.977780v1.6666671.66666711.977780v1.6666675.000000-7.808327v5.000000-5.000000-7.808327v5.000000-1.666667-7.808327v5.0000001.666667-7.808327v5.0000005.000000-7.808327#16vertices
cstypebsplinestechcurv0.510.000000deg338surf0.0000001.0000000.0000001.0000001314\1516910111256781234parmu-3.000000-2.000000-1.0000000.000000\1.0000002.0000003.0000004.000000parmv-3.000000-2.000000-1.0000000.000000\1.0000002.0000003.0000004.000000end
#1element
4.Cardinalsurface
ThisexampleshowsaCardinalsurface.
v-5.000000-5.0000000.000000v-5.000000-1.6666670.000000v-5.0000001.6666670.000000v-5.0000005.0000000.000000v-1.666667-5.0000000.000000v-1.666667-1.6666670.000000
v-1.6666671.6666670.000000v-1.6666675.0000000.000000v1.666667-5.0000000.000000v1.666667-1.6666670.000000v1.6666671.6666670.000000v1.6666675.0000000.000000v5.000000-5.0000000.000000v5.000000-1.6666670.000000v5.0000001.6666670.000000v5.0000005.0000000.000000#16vertices
cstypecardinal
stechcparma1.0000001.000000deg33surf0.0000001.0000000.0000001.0000001314\1516910111256781234parmu0.0000001.000000parmv0.0000001.000000end#1element
7/31/2019 Obj Format
23/51
5.RationalB-splinesurface
Thisexamplecreatesasecond-degree,rationalB-splinesurfaceusingopen,uniformknotvectors.Atexturemapisappliedtothesurface.
v-1.3-1.00.0v0.1-1.00.47.6v1.4-1.00.02.3v-1.40.00.2v0.10.00.90.5v1.30.00.41.5v-1.41.00.02.3v0.11.00.36.1v1.11.00.03.3vt0.00.0vt0.50.0vt1.00.0vt0.00.5vt0.50.5vt1.00.5vt0.01.0vt0.51.0vt1.01.0cstyperatbspline
deg22surf0.01.00.01.01/12/23/34/45/56/6\7/78/89/9parmu0.00.00.01.01.01.0parmv0.00.00.01.01.01.0end
6.TrimmedNURBsurface
ThisisacompleteexampleofafilecontainingatrimmedNURBsurfacewithnegativereferencenumbersforvertices.
#trimmingcurvevp-0.6751.8503.000vp0.9151.930vp2.4850.4702.000vp2.485-1.030vp1.605-1.89010.700vp-0.745-0.6540.500cstyperatbezierdeg3curv2-6-5-4-3-2-1-6parmu0.001.002.00end#surface
v-1.350-1.0300.000v0.130-1.0300.4327.600v1.480-1.0300.0002.300v-1.4600.0600.201v0.1200.0600.9150.500v1.3800.0600.4541.500v-1.4801.0300.0002.300v0.1201.0300.3946.100v1.1701.0300.0003.300cstyperatbspline
7/31/2019 Obj Format
24/51
deg22surf-1.02.5-2.02.0-9-8-7-6-5-4-3-2-1parmu-1.00-1.00-1.002.502.502.50parmv-2.00-2.00-2.00-2.00-2.00-2.00trim0.02.01end
7.Twotrimmingregionswithahole
ThisexampleshowsaBeziersurfacewithtwotrimmingregions,eachwithaholeinthem.
#outerloopoffirstregiondeg1cstypebeziervp0.1000.100vp0.9000.100vp0.9000.900vp0.1000.900curv212341parmu0.001.002.003.004.00end#holeinfirstregion
vp0.3000.300vp0.7000.300vp0.7000.700vp0.3000.700curv256785parmu0.001.002.003.004.00end#outerloopofsecondregionvp1.1001.100vp1.9001.100vp1.9001.900vp1.1001.900curv291011129
parmu0.001.002.003.004.00end#holeinsecondregionvp1.3001.300vp1.7001.300vp1.7001.700vp1.3001.700curv21314151613parmu0.001.002.003.004.00end#surfacev0.0000.0000.000v1.0000.0000.000
v0.0001.0000.000v1.0001.0000.000deg11cstypebeziersurf0.02.00.02.01234parmu0.002.00parmv0.002.00trim0.04.01hole0.04.02trim0.04.03
7/31/2019 Obj Format
25/51
hole0.04.04end
8.TrimmingwithaspecialcurveThisexampleissimilartothetrimmedNURBsurfaceexample(6),exceptthereisaspecialcurveonthesurface.Thisexampleusesnegativevertexnumbers.
#trimmingcurvevp-0.6751.8503.000vp0.9151.930vp2.4850.4702.000vp2.485-1.030vp1.605-1.89010.700vp-0.745-0.6540.500cstyperatbezierdeg3curv2-6-5-4-3-2-1-6parmu0.001.002.00end#specialcurvevp-0.1850.322vp0.2140.818
vp1.6520.207vp1.652-0.455curv2-4-3-2-1parmu2.0010.00end#surfacev-1.350-1.0300.000v0.130-1.0300.4327.600v1.480-1.0300.0002.300v-1.4600.0600.201v0.1200.0600.9150.500v1.3800.0600.4541.500v-1.4801.0300.0002.300
v0.1201.0300.3946.100v1.1701.0300.0003.300cstyperatbsplinedeg22surf-1.02.5-2.02.0-9-8-7-6-5-4-3-2-1parmu-1.00-1.00-1.002.502.502.50parmv-2.00-2.00-2.002.002.002.00trim0.02.01scrv4.29.72end
9.Trimmingwithspecialpoints
ThisexampleextendsthetrimmedNURBsurfaceexample(6)toincludespecialpointsonboththetrimmingcurveandsurface.Aspacecurvewithaspecialpointisalsoincluded.Thisexampleusesnegativevertexnumbers.
#specialpointandspacecurvedatavp0.500vp0.700vp1.100
7/31/2019 Obj Format
26/51
vp0.2000.950v0.3001.5000.100v0.0000.0000.000v1.0001.0000.000v2.0001.0000.000v3.0000.0000.000cstypebezierdeg3curv0.20.9-4-3-2-1sp1parmu0.001.00end#trimmingcurvevp-0.6751.8503.000vp0.9151.930vp2.4850.4702.000vp2.485-1.030vp1.605-1.89010.700vp-0.745-0.6540.500cstyperatbeziercurv2-6-5-4-3-2-1-6parmu0.001.002.00sp23end
#surfacev-1.350-1.0300.000v0.130-1.0300.4327.600v1.480-1.0300.0002.300v-1.4600.0600.201v0.1200.0600.9150.500v1.3800.0600.4541.500v-1.4801.0300.0002.300v0.1201.0300.3946.100v1.1701.0300.0003.300cstyperatbsplinedeg22surf-1.02.5-2.02.0-9-8-7-6-5-4-3-2-1
parmu-1.00-1.00-1.002.502.502.50parmv-2.00-2.00-2.002.002.002.00trim0.02.01sp4end
Connectivitybetweenfree-formsurfaces
Connectivityconnectstwosurfacesalongtheirtrimmingcurves.
Theconstatementspecifiesthefirstsurfacewithitstrimmingcurveandthesecondsurfacewithitstrimmingcurve.Thisinformationisusefulforedgemerging.Withoutthissurfaceandcurvedata,
connectivitymustbedeterminednumericallyatgreaterexpenseandwithreducedaccuracyusingthemgstatement.
Connectivitybetweensurfacesindifferentmerginggroupsisignored.Also,althoughconnectivitywhichcrossespointsofC1discontinuityintrimmingcurvesislegal,itisnotrecommended.Instead,usetwoconnectivitystatementswhichmeetatthepointofdiscontinuity.
Thetwocurvesandtheirstartingandendingparametersshouldallmaptothesamecurveandstartingandendingpointsinobjectspace.
7/31/2019 Obj Format
27/51
Syntax
consurf_1q0_1q1_1curv2d_1surf_2q0_2q1_2curv2d_2
Free-formgeometrystatement.
Specifiesconnectivitybetweentwosurfaces.
surf_1istheindexofthefirstsurface.
q0_1isthestartingparameterforthecurvereferencedbycurv2d_1.
q1_1istheendingparameterforthecurvereferencedbycurv2d_1.
curv2d_1istheindexofacurveonthefirstsurface.Thiscurvemusthavebeenpreviouslydefinedwiththecurv2statement.
surf_2istheindexofthesecondsurface.
q0_2isthestartingparameterforthecurvereferencedbycurv2d_2.
q1_2istheendingparameterforthecurvereferencedbycurv2d_2.
curv2d_2istheindexofacurveonthesecondsurface.Thiscurvemusthavebeenpreviouslydefinedwiththecurv2statement.
Example
1.Connectivitybetweentwosurfaces
Thisexampleshowstheconnectivitybetweentwosurfaceswithtrimmingcurves.
cstypebezier
deg11
v000v100v010v110
vp00vp10vp11vp01
curv212341
parmu0.01.02.03.04.0end
surf0.01.00.01.01234parmu0.01.0parmv0.01.0trim0.04.01end
v100
7/31/2019 Obj Format
28/51
v200v110v210
surf0.01.00.01.05678parmu0.01.0parmv0.01.0trim0.04.01end
con12.02.0124.03.01
Grouping
Therearefourstatementsinthe.objfiletohelpyoumanipulategroupsofelements:
o GropunamestatementsareusedtoorganizecollectionsofelementsandsimplifydatamanipulationforoperationsinModel.
o Smoothinggroupstatementsletyouidentifyelementsoverwhichnormalsaretobeinterpolatedtogivethoseelementsasmooth,
non-facetedappearance.Thisisaquickwaytospecifyvertexnormals.
o Merginggroupstatementsareusedtoideneifyfree-formelementsthatshouldbeinspectedforadjacencydetection.Youcanalsousemerginggroupstoexcludesurfaceswhicharecloseenoughtobeconsideredadjacentbutshouldnotbemerged.
o Objectnamestatementsletyouassignanametoanentireobjectinasinglefile.
Allgroupingstatementsarestate-setting.Thismeansthatonceagroupstatementisset,itappliestoallelementsthatfollow
untilthenextgroupstatement.
Thisportionofasamplefileshowsasingleelementwhichbelongstothreegroups.Thesmoothinggroupisturnedoff.
gsquarethingallsofff1234
Thisexampleshowstwosurfacesinmerginggroup1withamergeresolutionof0.5.
mg1.5
surf0.01.012345678910111213141516surf0.01.017181920212223242526272829303132
Syntax
ggroup_name1group_name2...
Polygonalandfree-formgeometrystatement.
Specifiesthegroupnamefortheelementsthatfollowit.Youcan
7/31/2019 Obj Format
29/51
havemultiplegroupnames.Iftherearemultiplegroupsononeline,thedatathatfollowsbelongtoallgroups.Groupinformationisoptional.
group_nameisthenameforthegroup.Letters,numbers,andcombinationsoflettersandnumbersareacceptedforgroupnames.Thedefaultgroupnameisdefault.
sgroup_number
Polygonalandfree-formgeometrystatement.
Setsthesmoothinggroupfortheelementsthatfollowit.Ifyoudonotwanttouseasmoothinggroup,specifyofforavalueof0.
TodisplaywithsmoothshadinginModelandPreView,youmustcreatevertexnormalsafteryouhaveassignedthesmoothinggroups.YoucancreatevertexnormalswiththevnstatementorwiththeModelprogram.
TosmoothpolygonalgeometryforrenderingwithImage,itissufficienttoputelementsinsomesmoothinggroup.However,vertexnormalsoverridesmoothinginformationforImage.
group_numberisthesmoothinggroupnumber.Toturnoffsmoothinggroups,useavalueof0oroff.Polygonalelementsusegroupnumberstoputelementsindifferentsmoothinggroups.Forfree-formsurfaces,smoothinggroupsareeitherturnedonoroff;thereisnodifferencebetweenvaluesgreaterthan0.
mggroup_numberres
Free-formgeometrystatement.
Setsthemerginggroupandmergeresolutionforthefree-formsurfacesthatfollowit.Ifyoudonotwanttouseamerginggroup,specifyofforavalueof0.
Adjacencydetectionisperformedonlywithingroups,neverbetweengroups.Connectivitybetweensurfacesindifferentmerginggroupsisnotallowed.Surfacesinthesamemerginggrouparemergedtogetheralongedgesthatarewithinthedistanceresapart.
NOTE:Adjacencydetectionisanexpensivenumericalcomparisonprocess.Itisbesttorestrictthisprocesstoassmalladomainaspossiblebyusingsmallmerginggroups.
group_numberisthemerginggroupnumber.Toturnoffadjacencydetection,useavalueof0oroff.
resisthemaximumdistancebetweentwosurfacesthatwillbemergedtogether.Theresolutionmustbeavaluegreaterthan0.Thisisarequiredargumentonlywhenusingmerginggroups.
oobject_name
Polygonalandfree-formgeometrystatement.
Optionalstatement;itisnotprocessedbyanyWavefrontprograms.Itspecifiesauser-definedobjectnamefortheelementsdefined
7/31/2019 Obj Format
30/51
afterthisstatement.
object_nameistheuser-definedobjectname.Thereisnodefault.
Examples
1.Cubewithgroupnames
Thefollowingexampleisacubewitheachofitsfacesplacedinaseparategroup.Inaddition,allelementsbelongtothegroupcube.
v0.0000002.0000002.000000v0.0000000.0000002.000000v2.0000000.0000002.000000v2.0000002.0000002.000000v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000#8vertices
gfrontcubef1234gbackcube
f8765grightcubef4378gtopcubef5148gleftcubef5621gbottomcubef2673#6elements
2.Twoadjoiningsquareswithasmoothinggroup
Thisexampleshowstwoadjoiningsquaresthatshareacommonedge.ThesquaresareplacedinasmoothinggrouptoensurethattheircommonedgewillbesmoothedwhenrenderedwithImage.
v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000v4.0000000.000000-1.255298v4.0000002.000000-1.255298#6vertices
galls1f1234f4356#2elements
3.Twoadjoiningsquareswithvertexnormals
Thisexamplealsoshowstwosquaresthatshareacommonedge.Vertex
7/31/2019 Obj Format
31/51
normalshavebeenaddedtothecornersofeachsquaretoensurethattheircommonedgewillbesmoothedduringdisplayinModelandPreViewandwhenrenderedwithImage.
v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000v4.0000000.000000-1.255298v4.0000002.000000-1.255298vn0.0000000.0000001.000000vn0.0000000.0000001.000000vn0.2765970.0000000.960986vn0.2765970.0000000.960986vn0.5316110.0000000.846988vn0.5316110.0000000.846988#6vertices
#6normals
galls1f1//12//23//34//4f4//43//35//56//6
#2elements
4.Merginggroup
ThisexampleshowstwoBeziersurfacesthatmeetatacommonedge.Theyhavebothbeenplacedinthesamemerginggrouptoensurecontinuityattheedgewheretheymeet.Thisprevents"cracks"fromappearingalongtheseambetweenthetwosurfacesduringrendering.Merginggroupswillbeignoredduringflat-shading,smooth-shading,andmaterialshadingofthesurface.
v-4.949854-5.0000000.000000
v-4.949854-1.6666670.000000v-4.9498541.6666670.000000v-4.9498545.0000000.000000v-1.616521-5.0000000.000000v-1.616521-1.6666670.000000v-1.6165211.6666670.000000v-1.6165215.0000000.000000v1.716813-5.0000000.000000v1.716813-1.6666670.000000v1.7168131.6666670.000000v1.7168135.0000000.000000v5.050146-5.0000000.000000v5.050146-1.6666670.000000
v5.0501461.6666670.000000v5.0501465.0000000.000000v-15.015566-4.9749910.000000v-15.015566-1.6416580.000000v-15.0155661.6916750.000000v-15.0155665.0250090.000000v-11.682233-4.9749910.000000v-11.682233-1.6416580.000000v-11.6822331.6916750.000000v-11.6822335.0250090.000000
7/31/2019 Obj Format
32/51
v-8.348900-4.9749910.000000v-8.348900-1.6416580.000000v-8.3489001.6916750.000000v-8.3489005.0250090.000000v-5.015566-4.9749910.000000v-5.015566-1.6416580.000000v-5.0155661.6916750.000000v-5.0155665.0250090.000000
mg10.500000
cstypebezierdeg33surf0.0000001.0000000.0000001.0000001314\1516910111256781234parmu0.0000001.000000parmv0.0000001.000000endsurf0.0000001.0000000.0000001.00000029303132252627282122\232417181920parmu0.0000001.000000parmv0.0000001.000000end
Display/renderattributes
DisplayandrenderattributesdescribehowanobjectlookswhendisplayedinModelandPreVieworwhenrenderedwithImage.
Someattributesapplytobothfree-formandpolygonalgeometry,suchasmaterialnameandlibrary,raytracing,andshadowcasting.Interpolationattributesapplyonlytopolygonalgeometry.Curveandsurfaceresolutionsareusedforonlyfree-formgeometry.
Thefollowingchartshowsthedisplayandrenderstatementsavailableforpolygonalandfree-formgeometry.
TableB1-1.Displayandrenderattributes
polygonalonly polygonalorfree-form free-formonly-------------- ---------------------- --------------bevel lod ctechc_interp usemtl stechd_interp mtllib
shadow_objtrace_obj
Alldisplayandrenderattributestatementsarestate-setting.Thismeansthatonceanattributestatementisset,itappliestoall
elementsthatfollowuntilitisresettoadifferentvalue.
Thefollowingsampleshowsrenderinganddisplaystatementsforafaceelement.:
s1usemtlblueusemapmarblef1234
7/31/2019 Obj Format
33/51
Syntax
Thefollowingsyntaxstatementsarelistedbythetypeofgeometry.Firstarestatementsforpolygonalgeometry.Secondarestatementsforbothfree-formandpolygonalgeometry.Thirdarestatementsforfree-formgeometryonly.
bevelon/off
Polygonalgeometrystatement.
Setsbevelinterpolationonoroff.Itworksonlywithbeveledobjects,thatis,objectswithsidesseparatedbybeveledfaces.
Bevelinterpolationusesnormalvectorinterpolationtogiveanillusionofroundnesstoaflatbevel.Itdoesnotaffectthesmoothingofnon-bevelledfaces.
Bevelinterpolationdoesnotalterthegeometryoftheoriginalobject.
onturnsonbevelinterpolation.
offturnsoffbevelinterpolation.Thedefaultisoff.
NOTE:Imagecannotrenderbevel-interpolatedelementsthathavevertexnormals.
c_interpon/off
Polygonalgeometrystatement.
Setscolorinterpolationonoroff.
Colorinterpolationcreatesablendacrossthesurfaceofapolygonbetweenthematerialsassignedtoitsvertices.Thiscreatesablendingofcolorsacrossafaceelement.
Tosupportcolorinterpolation,materialsmustbeassignedpervertex,notperelement.Theilluminationmodelsforallmaterialsofverticesattachedtothepolygonmustbethesame.Colorinterpolationappliestothevaluesforambient(Ka),diffuse(Kd),specular(Ks),andspecularhighlight(Ns)materialproperties.
onturnsoncolorinterpolation.
offturnsoffcolorinterpolation.Thedefaultisoff.
d_interpon/off
Polygonalgeometrystatement.
Setsdissolveinterpolationonoroff.
Dissolveinterpolationcreatesaninterpolationorblendacrossapolygonbetweenthedissolve(d)valuesofthematerialsassignedtoitsvertices.Thisfeatureisusedtocreateeffectsexhibitingvaryingdegreesofapparenttransparency,asinglassorclouds.
Tosupportdissolveinterpolation,materialsmustbeassignedper
7/31/2019 Obj Format
34/51
7/31/2019 Obj Format
35/51
mtllibfilename1filename2...
Polygonalandfree-formgeometrystatement.
Specifiesthemateriallibraryfileforthematerialdefinitionssetwiththeusemtlstatement.Youcanspecifymultiplefilenameswithmtllib.Ifmultiplefilenamesarespecified,thefirstfilelistedissearchedfirstforthematerialdefinition,thesecondfileissearchednext,andsoon.
WhenyouassignamateriallibraryusingtheModelprogram,onlyonemaplibraryper.objfileisallowed.Youcanassignmultiplelibrariesusingatexteditor.
filenameisthenameofthelibraryfilethatdefinesthematerials.Thereisnodefault.
shadow_objfilename
Polygonalandfree-formgeometrystatement.
Specifiestheshadowobjectfilename.Thisobjectisusedtocastshadowsforthecurrentobject.Shadowsareonlyvisibleinarenderedimage;theycannotbeseenusinghardwareshading.The
shadowobjectisinvisibleexceptforitsshadow.
Anobjectwillcastshadowsonlyifithasashadowobject.Youcanuseanobjectasitsownshadowobject.However,asimplifiedversionoftheoriginalobjectisusuallypreferableforshadowobjects,sinceshadowcastingcangreatlyincreaserenderingtime.
filenameisthefilenamefortheshadowobject.Youcanenteranyvalidobjectfilenamefortheshadowobject.Theobjectfilecanbean.objor.modfile.Ifafilenameisgivenwithoutanextension,anextensionof.objisassumed.
Onlyoneshadowobjectcanbestoredinafile.Ifmorethanone
shadowobjectisspecified,thelastonespecifiedwillbeused.
trace_objfilename
Polygonalandfree-formgeometrystatement.
Specifiestheraytracingobjectfilename.Thisobjectwillbeusedingeneratingreflectionsofthecurrentobjectonreflectivesurfaces.Reflectionsareonlyvisibleinarenderedimage;theycannotbeseenusinghardwareshading.
Anobjectwillappearinreflectionsonlyifithasatraceobject.Youcanuseanobjectasitsowntraceobject.However,a
simplifiedversionoftheoriginalobjectisusuallypreferablefortraceobjects,sinceraytracingcangreatlyincreaserenderingtime.
filenameisthefilenamefortheraytracingobject.Youcanenteranyvalidobjectfilenameforthetraceobject.Youcanenteranyvalidobjectfilenamefortheshadowobject.Theobjectfilecanbean.objor.modfile.Ifafilenameisgivenwithoutanextension,anextensionof.objisassumed.
7/31/2019 Obj Format
36/51
Onlyonetraceobjectcanbestoredinafile.Ifmorethanoneisspecified,thelastoneisused.
ctechtechniqueresolution
Free-formgeometrystatement.
Specifiesacurveapproximationtechnique.Theargumentsspecifythetechniqueandresolutionforthecurve.
Youmustselectfromoneofthefollowingthreetechniques.
ctechcparmres
Specifiesacurvewithconstantparametricsubdivisionusingoneresolutionparameter.Eachpolynomialsegmentofthecurveissubdividedntimesinparameterspace,wherenistheresolutionparametermultipliedbythedegreeofthecurve.
resistheresolutionparameter.Thelargerthevalue,thefinertheresolution.Ifreshasavalueof0,eachpolynomialcurvesegmentisrepresentedbyasinglelinesegment.
ctechcspacemaxlength
Specifiesacurvewithconstantspatialsubdivision.Thecurveisapproximatedbyaseriesoflinesegmentswhoselengthsinrealspacearelessthanorequaltothemaxlength.
maxlengthisthemaximumlengthofthelinesegments.Thesmallerthevalue,thefinertheresolution.
ctechcurvmaxdistmaxangle
Specifiescurvature-dependentsubdivisionusingseparateresolutionparametersforthemaximumdistanceandthemaximumangle.
Thecurveisapproximatedbyaseriesoflinesegmentsinwhich1)thedistanceinobjectspacebetweenalinesegmentandtheactualcurvemustbelessthanthemaxdistparameterand2)theangleindegreesbetweentangentvectorsattheendsofalinesegmentmustbelessthanthemaxangleparameter.
maxdististhedistanceinrealspacebetweenalinesegmentandtheactualcurve.
maxangleistheangle(indegrees)betweentangentvectorsattheendsofalinesegment.
Thesmallerthevaluesformaxdistandmaxangle,thefinertheresolution.
NOTE:Approximationinformationfortrimming,hole,andspecialcurvesisstoredinthecorrespondingsurface.Thectechstatementforthesurfaceisused,notthectechstatementappliedtothecurv2statement.Althoughuntrimmedsurfaceshavenoexplicittrimmingloop,aloopisconstructedwhichboundsthelegalparameterrange.Thisimplicitloopfollowsthesamerulesasanyotherloopandisapproximatedaccordingtothectechinformation
7/31/2019 Obj Format
37/51
forthesurface.
stechtechniqueresolution
Free-formgeometrystatement.
Specifiesasurfaceapproximationtechnique.Theargumentsspecifythetechniqueandresolutionforthesurface.
Youmustselectfromoneofthefollowingtechniques:
stechcparmauresvres
Specifiesasurfacewithconstantparametricsubdivisionusingseparateresolutionparametersfortheuandvdirections.Eachpatchofthesurfaceissubdividedntimesinparameterspace,wherenistheresolutionparametermultipliedbythedegreeofthesurface.
uresistheresolutionparameterfortheudirection.
vresistheresolutionparameterforthevdirection.
Thelargerthevaluesforuresandvres,thefinerthe
resolution.Ifyouenteravalueof0forbothuresandvres,eachpatchisapproximatedbytwotriangles.
stechcparmbuvres
Specifiesasurfacewithconstantparametricsubdivision,withrefinementusingoneresolutionparameterforboththeuandvdirections.
Aninitialtriangulationisperformedusingonlythepointsonthetrimmingcurves.Thistriangulationisthenrefineduntilalledgesareofanappropriatelength.Theresultingtrianglesarenotorientedalongisoparametriclinesastheyareinthe
cparmatechnique.
uvresistheresolutionparameterforboththeuandvdirections.Thelargerthevalue,thefinertheresolution.
stechcspacemaxlength
Specifiesasurfacewithconstantspatialsubdivision.
Thesurfaceissubdividedinrectangularregionsuntilthelengthinrealspaceofanyrectangleedgeislessthanthemaxlength.Theserectangularregionsarethentriangulated.
maxlengthisthelengthinrealspaceofanyrectangleedge.Thesmallerthevalue,thefinertheresolution.
stechcurvmaxdistmaxangle
Specifiesasurfacewithcurvature-dependentsubdivisionusingseparateresolutionparametersforthemaximumdistanceandthemaximumangle.
Thesurfaceissubdividedinrectangularregionsuntil1)the
7/31/2019 Obj Format
38/51
distanceinrealspacebetweentheapproximatingrectangleandtheactualsurfaceislessthanthemaxdist(approximately)and2)theangleindegreesbetweensurfacenormalsatthecornersoftherectangleislessthanthemaxangle.Followingsubdivision,theregionsaretriangulated.
maxdististhedistanceinrealspacebetweentheapproximatingrectangleandtheactualsurface.
maxangleistheangleindegreesbetweensurfacenormalsatthecornersoftherectangle.
Thesmallerthevaluesformaxdistandmaxangle,thefinertheresolution.
Examples
1.Cubewithmaterials
Thiscubehasadifferentmaterialappliedtoeachofitsfaces.
mtllibmaster.mtl
v0.0000002.0000002.000000
v0.0000000.0000002.000000v2.0000000.0000002.000000v2.0000002.0000002.000000v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000#8vertices
gfrontusemtlredf1234gback
usemtlbluef8765grightusemtlgreenf4378gtopusemtlgoldf5148gleftusemtlorangef5621gbottomusemtlpurple
f2673#6elements
2.Cubecastingashadow
Inthisexample,thecubecastsashadowontheotherobjectswhenitisrenderedwithImage.Thecube,whichisstoredinthefilecube.obj,referencesitselfastheshadowobject.
7/31/2019 Obj Format
39/51
mtllibmaster.mtlshadow_objcube.obj
v0.0000002.0000002.000000v0.0000000.0000002.000000v2.0000000.0000002.000000v2.0000002.0000002.000000v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000v2.0000002.0000000.000000#8vertices
gfrontusemtlredf1234gbackusemtlbluef8765grightusemtlgreenf4378gtopusemtlgold
f5148gleftusemtlorangef5621gbottomusemtlpurplef2673#6elements
3.Cubecastingareflection
Thiscubecastsitsreflectiononanyreflectiveobjectswhenitis
renderedwithImage.Thecube,whichisstoredinthefilecube.obj,referencesitselfasthetraceobject.
mtllibmaster.mtltrace_objcube.obj
v0.0000002.0000002.000000v0.0000000.0000002.000000v2.0000000.0000002.000000v2.0000002.0000002.000000v0.0000002.0000000.000000v0.0000000.0000000.000000v2.0000000.0000000.000000
v2.0000002.0000000.000000#8vertices
gfrontusemtlredf1234gbackusemtlbluef8765gright
7/31/2019 Obj Format
40/51
usemtlgreenf4378gtopusemtlgoldf5148gleftusemtlorangef5621gbottomusemtlpurplef2673#6elements
4.Texture-mappedsquare
Thisexampledescribesa2x2square.Itismappedwitha1x1squaretexture.Thetextureisstretchedtofitthesquareexactly.
mtllibmaster.mtl
v0.0000002.0000000.000000v0.0000000.0000000.000000
v2.0000000.0000000.000000v2.0000002.0000000.000000vt0.0000001.0000000.000000vt0.0000000.0000000.000000vt1.0000000.0000000.000000vt1.0000001.0000000.000000#4vertices
usemtlwoodf1/12/23/34/4#1element
5.Approximationtechniqueforasurface
ThisexampleshowsaB-splinesurfacewhichwillbeapproximatedusingcurvature-dependentsubdivisionspecifiedbythestechcommand.
gbspatchv-5.000000-5.000000-7.808327v-5.000000-1.666667-7.808327v-5.0000001.666667-7.808327v-5.0000005.000000-7.808327v-1.666667-5.000000-7.808327v-1.666667-1.66666711.977780v-1.6666671.66666711.977780v-1.6666675.000000-7.808327
v1.666667-5.000000-7.808327v1.666667-1.66666711.977780v1.6666671.66666711.977780v1.6666675.000000-7.808327v5.000000-5.000000-7.808327v5.000000-1.666667-7.808327v5.0000001.666667-7.808327v5.0000005.000000-7.808327#16vertices
7/31/2019 Obj Format
41/51
gbspatchcstypebsplinestechcurv0.510.000000deg33surf0.0000001.0000000.0000001.0000001314\1516910111256781234parmu-3.000000-2.000000-1.0000000.000000\1.0000002.0000003.0000004.000000parmv-3.000000-2.000000-1.0000000.000000\1.0000002.0000003.0000004.000000end#1element
6.Approximationtechniqueforacurve
ThisexampleshowsaBeziercurvewhichwillbeapproximatedusingconstantparametricsubdivisionspecifiedbythectechcommand.
v-2.3000001.9500000.000000v-2.2000000.7900000.000000v-2.340000-1.5100000.000000v-1.530000-1.4900000.000000
v-0.720000-1.4700000.000000v-0.7800000.2300000.000000v0.0700000.2500000.000000v0.9200000.2700000.000000v0.800000-1.6100000.000000v1.620000-1.5900000.000000v2.440000-1.5700000.000000v2.6900000.6700000.000000v2.9000001.9800000.000000#13vertices
gdefaultcstypebezier
ctechcparm1.000000deg3curv0.0000004.00000012345678910\111213parmu0.0000001.0000002.0000003.000000\4.000000end#1element
Comments
Commentscanappearanywhereinan.objfile.Theyareusedtoannotatethefile;theyarenotprocessed.
Hereisanexample:
#thisisacomment
TheModelprogramautomaticallyinsertscommentswhenitcreates.objfiles.Forexample,itreportsthenumberofgeometricvertices,texturevertices,andvertexnormalsinafile.
7/31/2019 Obj Format
42/51
#4vertices#4texturevertices#4normals
Mathematicsforfree-formcurves/surfaces
[IapologizebutthissectionwillmakeabsolutelynosensewhatsoeverwithouttheequationsanddiagramsandtherewasjustnoeasywaytoincludetheminapureASCIIdocument.Youshouldprobablyjustskipaheadtothesection"Supersededstatements."-Jim]
Generalforms
Rationalandnon-rationalcurvesandsurfaces
Ingeneral,anynon-rationalcurvesegmentmaybewrittenas:
where
K+1isthenumberofcontrolpoints
diarethecontrolpoints
nisthedegreeofthecurve
Ni,n(t)arethedegreenbasisfunctions
Extendingthistothebivariatecase,anynon-rationalsurfacepatchmaybewrittenas:
where:
K1+1isthenumberofcontrolpointsintheudirection
K2+1isthenumberofcontrolpointsinthevdirection
di,jarethecontrolpoints
misthedegreeofthesurfaceintheudirection
nisthedegreeofthesurfaceinthevdirection
Ni,m(u)arethedegreembasisfunctionsintheudirection
Nj,n(v)arethedegreenbasisfunctionsinthevdirection
NOTE:Thefrontofthesurfaceisdefinedasthesidewheretheuparameterincreasestotherightandthevparameterincreasesupward.
Wemayextendthiscurvetotherationalcaseas:
wherewiaretheweightsassociatedwiththecontrolpointsdi.Similarly,arationalsurfacemaybeexpressedas:
wherewi,jaretheweightsassociatedwiththecontrolpointsdi,j.
NOTE:Ifacurveorsurfaceinan.objfileisrational,itmustuse
7/31/2019 Obj Format
43/51
theratoptionwiththecstypestatementanditrequiressomeweightvaluesforeachcontrolpoint.
Theweightsfortherationalformaregivenasathirdcontrolpointcoordinate(fortrimmingcurves)orfourthcoordinate(forspacecurvesandsurfaces).Theseweightsareoptionalanddefaultto1.0ifnotgiven.
Thisdefaultweightisonlyreasonableforcurvesandsurfaceswhosebasisfunctionssumto1.0,suchasBezier,Cardinal,andNURB.ItdoesnotmakesenseforTaylorandmayormaynotmakesenseforarepresentationgiveninbasis-matrixform.
ForallformsotherthanB-spline,thefinalcurveorsurfaceisconstructedbypiecingtogethertheindividualcurvesegmentsorsurfacepatches.Aglobalparameterspaceisthendefinedovertheentirecompositecurveorsurfaceusingtheparametervectorgivenwiththeparmstatement.
Theparametervectorforacurveisalistofpglobalparametervalues
{t1,...,tp}.Ift1t
7/31/2019 Obj Format
44/51
1.xixi+1,
2.x0
7/31/2019 Obj Format
45/51
withtheparmstatementmustbeK-n+2,whereKisthenumberofcontrolpoints.Forsurfaces,thisrequirementappliesindependentlyfortheuandvparametricdirections.
Taylor
TypetaylorspecifiesarbitrarydegreeTaylorpolynomialcurvesandsurfaces.Thebasisfunctionissimply:
NOTE:Thecontrolpointsinthiscasearethepolynomialcoefficientsandhavenoobviousgeometricsignificance.
Whenusingtypetaylor,thenumberofglobalparametervaluesgivenwiththeparmstatementmustbe(K+1)/(n+1)+1,whereKisthenumberofcontrolpoints.Forsurfaces,thisrequirementappliesindependentlyfortheuandvparametricdirections.
Basismatrix
Typebmatrixspecifiesgeneral,arbitrary-degreecurvesdefinedthroughtheuseofabasismatrixratherthananexplicittypesuchasBezier.Thebasisfunctionsaredefinedas:
wherethebasismatrixisthebi,j.Inordertomakethematrixnature
ofthismoreobvious,wemayalsowrite:
Whenconstructingbasismatrices,youshouldkeepthisdefinitioninmind,asdifferentauthorswritethisindifferentways.Amorecommonmatrixrepresentationis:
Tousesuchmatricesinthe.objfile,simplytransposethematrixandreversethecolumnordering.
Whenusingtypebasis,thenumberofglobalparametervaluesgivenwiththeparmstatementmustbe(K-n)/s+2,whereKisthenumberofcontrolpointsandsisthestepsizegivenwiththestepstatement.Forsurfaces,thisrequirementappliesindependentlyfortheuandv
parametricdirections.
Surfacevertexdata
Controlpoints
Thecontrolpointsforasurfaceconsistingofasinglepatcharelistedintheorderi=0toK1forj=0,followedbyi=0toK1forj=1,andsoonuntilj=K2.
Forsurfacesmadeupofmanypatches,whichistheusualcase,thecontrolpointsareorderedasifthesurfacewereasinglelargepatch.Forexample,thecontrolpointsforabicubicBeziersurfaceconsisting
offourpatcheswouldbearrangedasfollows:
where(m,n)istheglobalparameterspaceofthesurfaceandthenumbersindicatetheorderingofthevertexindicesinthesurfstatement.
Textureverticesandtexturemapping
Whentextureverticesarenotsupplied,theoriginalsurfaceparameterizationisusedfortexturemapping.However,iftexture
7/31/2019 Obj Format
46/51
verticesaresupplied,theyareinterpretedasadditionalinformationtobeinterpolatedorapproximatedseparatelyfrom,butusingthesameinterpolationfunctionsasthecontrolvertices.
Thatis,whereasthesurfaceitself,inthenon-rationalcase,wasgiveninthesection"Rationalandnon-rationalcurvesandsurfaces"as:
thetextureverticesareinterpolatedorapproximatedby:
whereti,jarethetextureverticesandthebasisfunctionsarethesameasforS(u,v).ItisT(u,v),ratherthanthesurfaceparameterization(u,v),whichisusedwhenatexturemapisapplied.
Vertexnormalsandnormalmapping
Vertexnormalsaretreatedexactlyliketexturevertices.Whenvertexnormalsarenotsupplied,thetruesurfacenormalsareused.Ifvertexnormalsaresupplied,theyarecalculatedas:
whereqi,jarethevertexnormalsandthebasisfunctionsarethesameasforS(u,v)andT(u,v).
NOTE:Vertexnormalsdonotaffecttheshapeofthesurface;theyaresimplyassociatedwiththetriangleverticesinthefinaltriangulation.Aswithfaces,supplyingvertexnormalsonlyaffectslightingcalculationsforthesurface.
Thetreatmentofbothtextureverticesandvertexnormalsinthecaseofrationalsurfacesisidentical.ItisimportanttonoticethatevenwhenthesurfaceS(u,v)isrational,thetextureandnormalsurfaces,T(u,v)andQ(u,v),arenotrational.Thisisbecausethecontrolpoints(thetextureverticesandvertexnormals)areneverrational.
Curveandsurfaceoperations
Specialpoints
Thefollowingequationsgiveamoreprecisedescriptionofspecialpointsforspacecurvesanddiscusstheextensiontotrimmingcurvesandsurfaces.
LetC(t)beaspacecurvewiththeglobalparametert.Wecanapproximatethiscurvebyasetofk-1linesegmentswhichconnectthepoints:
forsomesetofkglobalparametervalues{t1,...,tk}
Givenaspecialpointtsintheparameterspaceofthecurve(referencedbyvp),weguaranteethatts{t1,...,tk}.Morespecifically,weapproximatethecurveby:
where,atthepointiwheretsisinserted,wehavetits
7/31/2019 Obj Format
47/51
LetT(t)beaspecialcurvewiththeglobalparametert.Wehave:
where(m,n)isapointintheglobalparameterspaceofasurface.Wecanapproximatethiscurvebyasetofk-1linesegmentswhichconnectthepoints:
forsomesetofkglobalparametervalues.
LetS(m,n)beasurfacewiththeglobalparametersmandn.Wecanapproximatethissurfacebyatriangulationofasetofppoints.
whichlieonthesurface.WefurtherdefineEasthesetofalledgessuchthatei,jEimpliesthatS(mi,ni)andS(mj,nj)areconnectedinthetriangulation.Finally,weguaranteethatthereexistssomesubsetofE:
suchthatthepoints:
areconnectedinthetriangulation.
Connectivity
Recallthatthesyntaxoftheconstatementis:
consurf_1q0_1q1_1curv2d_1surf_2q0_2q1_2curv2d_2
Ifwelet:
T1(t1)bethecurvereferencedbycurv2d_1
S1(m1,n1)bethesurfacereferencedbysurf1onwhichT1(t1)lies
T2(t2)bethecurvereferencedbycurv2d_2
S2(m2,n2)bethesurfacereferencedbysurf2onwhichT2(t2)lies
thenS1(T1(t1)),S2(T2(t2))mustbeidenticaluptoreparameterization.Moreover,itmustbethecasethat:
S1(T1(q0_1))=S2(T2(q0_2))
and:
S1(T1(q1_1))=S2(T2(q1_2))
ItisalongthecurveS1(T1(t1))betweent1=q0_1andt1=q1_1,andthecurveS2(T2(t2))betweent2=q0_2andt2=q1_2thatthesurfaceS1(m1,n1)isconnectedtothesurfaceS2(m2,n2).
Supersededstatements
Thenew.objfileformathaseliminatedtheneedforseveralpatchandcurvestatements.Thesestatementshavebeenreplacedbyfree-formgeometrystatements.
Inthe3.0release,thefollowingkeywordshavebeensuperseded:
7/31/2019 Obj Format
48/51
obsp
obzp
ocdc
ocdp
ores
Youcanstillreadthesestatementsinthisversion3.0,however,thesystemwillnolongerwritefilesinthisformat.
Thisreleaseisthelastreleasethatwillreadthesestatements.Ifyouwanttosaveanydatafromthisformat,readinthefileandwriteitout.Thesystemwillconvertthedatatothenew.objformat.
Formoreinformationonthenewsyntaxstatements,see"Specifyingfree-formcurvesandsurfaces."
Syntax
Thefollowingsyntaxstatementsareforthesupersededkeywords.
bspv1v2...v16
SpecifiesaB-splinepatch.B-splinepatcheshavesixteencontrolpoints,definedasvertices.Onlyfourofthecontrolpointsaredistributedoverthesurfaceofthepatch;theremainderaredistributedaroundtheperimeterofthepatch.
PatchesmustbetessellatedinModelbeforetheycanbecorrectlyshadedorrendered.
visthevertexnumberforacontrolpoint.Sixteenvertexnumbersarerequired.Positivevaluesindicateabsolutevertexnumbers.Negativevaluesindicaterelativevertexnumbers.
bzpv1v2...v16
SpecifiesaBezierpatch.Bezierpatcheshavesixteencontrolpoints,definedasvertices.Thecontrolpointsaredistributeduniformlyoveritssurface.
PatchesmustbetessellatedinModelbeforetheycanbecorrectlyshadedorrendered.
visthevertexnumberforacontrolpoint.Sixteenvertexnumbersarerequired.Positivevaluesindicateabsolutevertexnumbers.Negativevaluesindicaterelativevertexnumbers.
cdcv1v2v3v4v5...
SpecifiesaCardinalcurve.Cardinalcurveshaveaminimumoffourcontrolpoints,definedasvertices.
Cardinalcurvescannotbecorrectlyshadedorrendered.TheycanbetessellatedandthenextrudedinModeltocreate3Dshapes.
visthevertexnumberforacontrolpoint.Aminimumoffour
7/31/2019 Obj Format
49/51
vertexnumbersarerequired.Thereisnolimitonthemaximum.Positivevaluesindicateabsolutevertexnumbers.Negativevaluesindicaterelativevertexnumbers.
cdpv1v2v3...v16
SpecifiesaCardinalpatch.Cardinalpatcheshavesixteencontrolpoints,definedasvertices.Fourofthecontrolpointsareattachedtothecornersofthepatch.
PatchesmustbetessellatedinModelbeforetheycanbecorrectlyshadedorrendered.
visthevertexnumberforacontrolpoint.Sixteenvertexnumbersarerequired.Positivevaluesindicateabsolutevertexnumbers.Negativevaluesindicaterelativevertexnumbers.
resusegvseg
Referenceanddisplaystatement.
SetsthenumberofsegmentsforBezier,B-splineandCardinalpatchesthatfollowit.
usegisthenumberofsegmentsintheudirection(horizontalorxdirection).Theminimumsettingis3andthemaximumsettingis120.Thedefaultis4.
vsegisthenumberofsegmentsinthevdirection(verticalorydirection).Theminimumsettingis3andthemaximumsettingis120.Thedefaultis4.
Comparisonof2.11and3.0syntax
Cardinalcurve
Thefollowingexampleshowsthe2.11syntaxandthe3.0syntaxforthe
sameCardinalcurve.
2.11Cardinalcurve
#2.11CardinalCurve
v2.5700001.2800000.000000v0.9400001.3400000.000000v-0.6700000.8200000.000000v-0.770000-0.9400000.000000v1.030000-1.3500000.000000v3.070000-1.3100000.000000#6vertices
cdc123456
3.0Cardinalcurve
#3.0Cardinalcurve
v2.5700001.2800000.000000v0.9400001.3400000.000000
7/31/2019 Obj Format
50/51
v-0.6700000.8200000.000000v-0.770000-0.9400000.000000v1.030000-1.3500000.000000v3.070000-1.3100000.000000#6vertices
cstypecardinaldeg3curv0.0000003.000000123456parmu0.0000001.0000002.0000003.000000end#1element
Bezierpatch
Thefollowingexampleshowsthe2.11syntaxandthe3.0syntaxforthesameBezierpatch.
2.11Bezierpatch
#2.11BezierPatchv-5.000000-5.0000000.000000v-5.000000-1.6666670.000000v-5.0000001.6666670.000000
v-5.0000005.0000000.000000v-1.666667-5.0000000.000000v-1.666667-1.6666670.000000v-1.6666671.6666670.000000v-1.6666675.0000000.000000v1.666667-5.0000000.000000v1.666667-1.6666670.000000v1.6666671.6666670.000000v1.6666675.0000000.000000v5.000000-5.0000000.000000v5.000000-1.6666670.000000v5.0000001.6666670.000000v5.0000005.0000000.000000
#16vertices
bzp12345678910111213141516#1element
3.0Bezierpatch
#3.0Bezierpatch
v-5.000000-5.0000000.000000v-5.000000-1.6666670.000000v-5.0000001.6666670.000000v-5.0000005.0000000.000000
v-1.666667-5.0000000.000000v-1.666667-1.6666670.000000v-1.6666671.6666670.000000v-1.6666675.0000000.000000v1.666667-5.0000000.000000v1.666667-1.6666670.000000v1.6666671.6666670.000000v1.6666675.0000000.000000v5.000000-5.0000000.000000v5.000000-1.6666670.000000
7/31/2019 Obj Format
51/51
v5.0000001.6666670.000000v5.0000005.0000000.000000#16vertices
cstypebezierdeg33surf0.0000001.0000000.0000001.0000001314\1516910111256781234parmu0.0000001.000000parmv0.0000001.000000end#1element