tag:blogger.com,1999:blog-24150652674465581722023-11-15T23:11:57.945-08:00Smokin' Guns & Q3 mappingJoe Kari's mapping tutorial and tips for "Smokin' Guns", a game based on Q3 engine.Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-2415065267446558172.post-30255960406696076222010-03-14T10:53:00.000-07:002010-03-14T11:11:24.472-07:00Tree tutorial part 2<span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);">Advanced tricks to get better effect</span></span><br /><br />This tutorial is the second part of <a href="http://sgq3-mapping.blogspot.com/2010/03/misfit-model-3d-and-q3-based-game.html">this one</a>.<br /><br />I was not very proud of the result of the first tree I made, so I decided to improve it.<br /><br />Firstly, I asked my brother to make a good foliage texture, and to make another texture that mix foliage and small branches. That last texture should have branches that start at the center of the image.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJTJtxFJ3y2IUb-dxJHHAEJoW8zX_tBoRgafOBaZawXHNaRSVh_c2ljSd-QbcsNB13JcvGOnadm_ve-_HsD3Ee64xOdgZDbvC447cpkCCp4kWZnR6HRJo5LDpoFiVWkJcEuGtqm2jKnVU/s1600-h/1.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJTJtxFJ3y2IUb-dxJHHAEJoW8zX_tBoRgafOBaZawXHNaRSVh_c2ljSd-QbcsNB13JcvGOnadm_ve-_HsD3Ee64xOdgZDbvC447cpkCCp4kWZnR6HRJo5LDpoFiVWkJcEuGtqm2jKnVU/s400/1.jpg" alt="" id="BLOGGER_PHOTO_ID_5448549860501672834" border="0" /></a><br /><br />So, the trick to do this smarter foliage is to mix 2 kinds of foliage geometry.<br /><br />The first one was used in the previous tutorial, it consists in ellipsoid (streched sphere) of "foliage only" texture. Now I plan to restrict the use of this one to the minimum, just to "fill" the tree with many leaves.<br /><br />Here is the second one.<br /><br />Let's create a pentagon:<br /><br /><ul><li>Create a cylinder, with 1 segment and 5 sides</li><li>Choose the select vertex tool (shortcut V)</li><li>Select all vertexes of one pentagon and delete them (shortcut Del), now they isn't cylinder anymore, just a pentagon</li></ul><br />Now we have to add the new material. Just like the 1st part of this tutorial, simply open the material panel, create a new material named "branches", browse texture (in this tutorial, I use "textures/joekari_plant/plant_green_branches1.tga"). Don't forget to open model's meta data and add the key/value pair: "MD3_PATH_branches" / "textures/joekari_plant/".<br /><br />Now select all the 5 faces of your pentagon, open the group panel (Crtl G), create a new group named "branches", set its material to "branches", and click the button "assign as group". Leave this panel.<br /><br />Open the texture coordinate panel (Ctrl E), and choose the projection type "group" (if it's already selected - sometime this feature is buggy - first select "triangle", then select "group" again). A dialog box appear, asking you from where the projection is set (bottom, top, right, left, front or back). Choose the right option (it depends on which viewport you have drawn your cylinder). If you don't know what to choose, simply choose the same than the viewport's name where you have your pentagon (other's view only display lined vertexes). Then, adjust scale and rotation to get the most of your texture without having seam:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSCabOQF8tirXKNYdS1Al4FibLHQHim7LLSo1AUbQkUcRGYR2T99N2h6Zc_8tU5C7SLzDzAzHyUiUMDL0LdvVtaGzuxWxotJs81LS5B2zuoHegfjuBJuzp0ladX2SvP7oklyj2AOh3s-w/s1600-h/2.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 232px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSCabOQF8tirXKNYdS1Al4FibLHQHim7LLSo1AUbQkUcRGYR2T99N2h6Zc_8tU5C7SLzDzAzHyUiUMDL0LdvVtaGzuxWxotJs81LS5B2zuoHegfjuBJuzp0ladX2SvP7oklyj2AOh3s-w/s400/2.jpg" alt="" id="BLOGGER_PHOTO_ID_5448549791720734786" border="0" /></a><br />Now select the central vertex of the pentagon, and in another viewport move it (shortcut M).<br />You have a nice set of branches.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgijkOZeJNpSjVB9NcckLq_OoB5cHfX5tSzJS0-oNbxq7l6u-sUXpvbJBn4-OuQiKj0uOZIck-wPvsqDTcgyOF57iXvdTTHh0anZnRC7oTjqMdjzVKs4pG9PI29rAOqs6ViJ2DfGTFH6WE/s1600-h/3.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 197px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgijkOZeJNpSjVB9NcckLq_OoB5cHfX5tSzJS0-oNbxq7l6u-sUXpvbJBn4-OuQiKj0uOZIck-wPvsqDTcgyOF57iXvdTTHh0anZnRC7oTjqMdjzVKs4pG9PI29rAOqs6ViJ2DfGTFH6WE/s400/3.jpg" alt="" id="BLOGGER_PHOTO_ID_5448549721873721346" border="0" /></a><br />Now, just copy and paste them everywhere on your tree.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLQPCjBwqbOTIoT_7DLBaPVtoL2k35esN4-K99ZTf_n0w0RE5QwEmY7TPHplEqE9JQayW6Bv4yXZJXuN72MLrtKzEf1Vv3rwAxquCes_8j3RlW2beApOsvdH4W2G2Z1GRXD4LbEXdxiG8/s1600-h/4.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 197px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLQPCjBwqbOTIoT_7DLBaPVtoL2k35esN4-K99ZTf_n0w0RE5QwEmY7TPHplEqE9JQayW6Bv4yXZJXuN72MLrtKzEf1Vv3rwAxquCes_8j3RlW2beApOsvdH4W2G2Z1GRXD4LbEXdxiG8/s400/4.jpg" alt="" id="BLOGGER_PHOTO_ID_5448549589137225698" border="0" /></a><br />Finally, just mix the 2 kind of foliage (pentagonal with branches and foliage texture, and ellipsoid with foliage only texture).<br />Use only few ellipsoid foliage, one per big branches.<br />You should get this :<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXvYtf1UfhgllngB5zp8kG5d2n0Jwh4kaTdGtmepRhu_7JTWy7MoTQyFc_JRbB8eP9bC5jqMiwms5DnrZJyeHjY0WX8orDSAOBROINlVGDvuxEyTx2EN8NzOVnR3o4iPCDbyP8RtH5IHg/s1600-h/5.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 197px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXvYtf1UfhgllngB5zp8kG5d2n0Jwh4kaTdGtmepRhu_7JTWy7MoTQyFc_JRbB8eP9bC5jqMiwms5DnrZJyeHjY0WX8orDSAOBROINlVGDvuxEyTx2EN8NzOVnR3o4iPCDbyP8RtH5IHg/s400/5.jpg" alt="" id="BLOGGER_PHOTO_ID_5448549516583567890" border="0" /></a><br /><br />(Note that on this screenshot, I have enabled alpha blending for the 3D viewport, in the menu : "view -> 3D alpha").<br /><br />And in game :<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxIWf_RriHgf_bQYU2qSQF8XX1a6lG58eAJD6LuwUT5FE7mk93pY-bENzN0HjILG-CROhjNBxhVvOThTASRqsVssItI8D-Ni_qYjGB5C-mNDkzTKb2Anf0H-wxn-qudRshN4hoKVzW_dU/s1600-h/6.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 387px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxIWf_RriHgf_bQYU2qSQF8XX1a6lG58eAJD6LuwUT5FE7mk93pY-bENzN0HjILG-CROhjNBxhVvOThTASRqsVssItI8D-Ni_qYjGB5C-mNDkzTKb2Anf0H-wxn-qudRshN4hoKVzW_dU/s400/6.jpg" alt="" id="BLOGGER_PHOTO_ID_5448549451712791858" border="0" /></a><br />Yeah, I'm pretty proud of this one, hope you like it too ;)Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com0tag:blogger.com,1999:blog-2415065267446558172.post-684759523327816282010-03-03T17:53:00.000-08:002010-03-03T18:46:18.043-08:00Misfit Model 3D and Q3-based game + a simple tree tutorial<span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(204, 0, 0);">Here we will see how to :</span></span><br /><br /><ul><li>use Misfit Model 3D</li><li>export MD3 for any Q3-based game</li><li>make a simple tree</li></ul><span style="font-style: italic;"></span><blockquote><span style="font-style: italic;">Please note that I'm using Misfit Model 3D 1.3.8 development version, you can found it <a href="http://www.misfitcode.com/misfitmodel3d/download.html">here</a>. This is a free open source software (GPL version 2)</span>.</blockquote><br />First we have to make the trunk and branches of the tree.<br /><br />We will use cylinder as primitive for that. Depending on the size of the trunk a cylinder with 10 or 12 sides is good. For the branches, we need 6 or 8 cylinder sides.<br /><br />So let's start to create those 2 cylinders.<br /><br /><ul><li>Choose the cylinder primitive tool</li><li>Some option appear under the toolbar, set side to 10 and segment to 5 (it will be usefull to have many segment to "bend" branches and trunk later), keep the 2 others value to 100</li><li>Drag your cursor in the front 2D view</li><li>You should see that:</li></ul><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFp_UZWSx_yFSr1XI-81ut0retl7eavi_7_fUQKcWGrYQwAf9bZoXVXV3aQ2eLcvdaN5BmVCgzKjMkK1gKvPEXvWDB7-Z2qO1bmTDA8WpCmRZHRjYeNAy0vT4ykBRv2oX_YgmDt7S7M9s/s1600-h/1.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 252px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFp_UZWSx_yFSr1XI-81ut0retl7eavi_7_fUQKcWGrYQwAf9bZoXVXV3aQ2eLcvdaN5BmVCgzKjMkK1gKvPEXvWDB7-Z2qO1bmTDA8WpCmRZHRjYeNAy0vT4ykBRv2oX_YgmDt7S7M9s/s400/1.jpg" alt="" id="BLOGGER_PHOTO_ID_5444596931847048674" border="0" /></a><br /><br /><br /><br /><br /><blockquote>Some trick about how to navigate in 2D and 3D view:<br /><ul><li>to zoom in or zoom out the view: use the mouse wheel while hovering a 2D or 2D view</li><li>to move: middle click (the mouse button) while moving the mouse</li><li>to turn around: in the 3D view just left click while moving, in a 2D view left click while pressing the Ctrl key and moving (you will turn this view into orthographic view, to turn it back to front/back/top/bottom/left/right view, just select the right item in the drop-down list just above the view)</li><li>to rotate: press Ctrl key while using mouse wheel (note that in 2D view it leads to orthographic view, same notice as above)</li></ul><br />Note that in Misfit Model 3D, the 3D view is just for visualization, you can't perform anything here.</blockquote><br /><br /><br /><br /><ul><li>Now choose the rotation tool</li><li>In the front view, rotate 90° the cylinder, you have to press Shift while doing it so that the cylinder will only move by 15° degree increment</li><li>Choose the scale tool, set tool's option (just under the toolbar) to "keep 2D aspect" and adjust the size of your trunk in the top view</li><li>Choose the "vertex select tool" (shortcut: V)</li><li>In the top view, select the vertex at the center of the disc, you have probably select 2 vertex</li></ul><br /><br /><blockquote>About each 4 select tools:<br /><ul><li>a left-click-drag select</li><li>a Shift + left-click-drag add to current selection</li><li>a right-click-drag remove some part of the current selection</li></ul><br />There are 2 ways of selecting vertex:<br /><ul><li>choose exactly the vertex you want in a 2D orthographic view (you have to move and turn around to be sure to select only vertex you want)</li><li>my prefered way to do it (most of time it is faster) is to simply select in a standard front/back/top/bottom/left/right view, and then deselect undesired vertex in another 2D view</li></ul><br />You should notice that at the bottom right of the window, you know everytime how many vertex and faces you have selected, and the total vertex and faces count of the whole model. For example:<br />V:30/62 F:40/120<br />... indicate your whole model have 62 vertex and 120 faces, you have currently selected 30 vertex and 40 faces.</blockquote><br /><br /><br /><ul><li>Deselect the higher vertex (so with a right-click-drag) in the front view</li><li>Hit the delete key to erase this vertex (or in the menu choose Geometry->Delete): we don't need extra face at the base of the trunk since those face will never be seen in-game</li><li>Select again the central vertex in the top view</li><li>Choose the move tool (shortcut: M), and in the front view, move this vertex higher (you can press Shift to constrain the move along axis)</li><li>You should get that:</li></ul><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTvwGbyPJOisMd1gCjGQMrHx7cqRzyAqCCMGEJjCtEaPHrB2JJKniX-uGZhfFSYt1lCuMJ45PF0Pof6aczuP_KfbR0D0QwEDvvKBJPLCREmS2ZrIhWf93XY1SR5wAHEDlMSOb-1EIOnk/s1600-h/2.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRTvwGbyPJOisMd1gCjGQMrHx7cqRzyAqCCMGEJjCtEaPHrB2JJKniX-uGZhfFSYt1lCuMJ45PF0Pof6aczuP_KfbR0D0QwEDvvKBJPLCREmS2ZrIhWf93XY1SR5wAHEDlMSOb-1EIOnk/s400/2.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597091692335906" border="0" /></a><br /><br /><br />Now we have to texture it right now, because it will be a nightmare to do it later. For instance, the model is a simple cylinder with a peak at the top, so we can use a cylinder projection for texture coordinate.<br />Always texturize your models early if you can. Always have in mind the way you will texturize it.<br />Designing the whole geometry and texturize it at the end is often a disaster (with the exception of complex models like human or animal, for those models you have to use another kind of software: unwrapper).<br /><br /><br />So...<br /><ul><li>First, it is time to save your model somewhere right now, because now, we will use texture (that are external), so if we don't want to bother later with path, save it under the directory smokinguns/models/my_models_directory (or my_q3mod/models/my_models_directory)</li><li>Enter the menu Materials->Edit Material (shortcut Ctrl+M), it open a material panel</li><li>Now click the button "new material" and give it a name: "wood". The name is important, cause later we will define MD3 model's meta data, so choose a short name, if this name has 2 word, use the underscore '_' to separate them</li><li>Click the "choose texture" button and browse smokinguns textures (I choose smokinguns/textures/joekari_wood/wood_breli_bark1.jpg in this example)</li><li>Click "ok" and leave the material panel</li></ul><br /><br /><br />Now we will deal right now with the MD3 Meta data. It is one of the trikiest part of MD3 modeling, since there isn't any documentation on how to do it well... I have had hard time to figure out how to do it the way it can support multiple texture/shader that are NOT in the same path than the model. Fortunately, I will give you the result of hours of headache.<br /><br /><ul><li>Enter the menu "model -> edit model meta data" (here I'm guessing the menu entry name, cause I'm running a french version of Misfit Model 3D).</li><li>Click the new button, a new line appear (name / value), double-click it, a dialog box appear</li><li>Set the name to "MD3_PATH_wood", note that IT IS CASE SENSITIVE, the rule is "MD3_PATH_" + the name of your material that should match. We have previously named this material "wood", the meta data name should be</li><li>"MD3_PATH_wood"</li><li>In the value field, enter the directory path of your texture where Radiant and quake3/smokinguns.exe will found it, here it is "textures/joekari_wood/" (note that it is just the directory part, not the complete path, the filename is not required here).</li><li>Click "ok" to close the dialog box, and then "ok" to close the meta data panel</li></ul><br /><br /><br />Now we are going to apply texture on our model.<br /><br /><ul><li>Choose the "connected mesh tool" (shortcut C) and click somewhere inside your model in a 2D view. The connected mesh tool select all face that are connected together. All your model should turn red right now.</li><li>Enter the menu "Material -> Edit group" (shortcut Ctrl+G), it open a panel to manage group</li><li>Click the "new" button, a dialog appear, name it "wood" (note that you can name it whatever you want, it is only for your convenience, and have no effect), hit "ok" and close the dialog box</li><li>Back in the group panel, click the "add to group" button: it will add all selected faces to the group named "wood"</li><li>Choose in the drop-down texture list the only one material we have: wood</li><li>Click "ok" to leave this panel</li></ul><br /><br /><br />Now your 3D view show you that your model have a texture:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaAGTnF90g5LGvXTpd9j4wLNQVK84jjMDFMlaYCOVU6h4BBoKqKjukRKaJn0T01cv44-SB2cTb9jzLih8Vv22gHlVpFt6v8ZXPIg7GJvOuYV5ELuI2yWW3TwdedPRiE3eH_xxvaQ1ZAt8/s1600-h/3.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 290px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaAGTnF90g5LGvXTpd9j4wLNQVK84jjMDFMlaYCOVU6h4BBoKqKjukRKaJn0T01cv44-SB2cTb9jzLih8Vv22gHlVpFt6v8ZXPIg7GJvOuYV5ELuI2yWW3TwdedPRiE3eH_xxvaQ1ZAt8/s400/3.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597905147919186" border="0" /></a><br /><br /><br />For instance, the texture coordinate are just silly, as you can see. So...<br /><br /><ul><li>Choose the "create projection tool", some tool's option appear under the toolbar, choose the type "cylinder"</li><li>In the front view, drag a projection cylinder over your model (press Shift to constrain it along one axis)</li><li>Choose the move tool (if you have deslected the projection, select it again with the "select projection tool"), and move the projection, using the top view to center it on your model</li><li>Now, using the "select connected mesh tool" (shortcut C), click your model</li><li>Enter the menu "Material -> Edit projection", it open a panel, click the button "add faces to projection" and close the projection panel</li><li>Select the projection (with the select projection tool), then delete it (delete key): Misfit remember that face are linked to a projection, and when you move the projection or the model, the textures coordinate are moving, so to prevent that, we just destroy the projection</li><li>Select your whole model (same way than before)</li><li>Enter the menu "Material -> Edit texture coordinate" (shortcut Ctrl+E), it open the texture coordinate panel, here you can see the way all your selected face are using your texture. If you need it, choose the "scale tool" of the texture coordinate panel, uncheck "keep aspect ratio", and rescale the texture the way you want (note that the 3D view in the background window is updated in real time)</li><li>Where rescaling horizontaly, have in mind that your texture should wrap around, or you will see a seam line somewhere on you model (you should use 1 time, 2 times or 3 times the texture width, but not one and a half for example)... how to do it ? Set the zoom value to 2 for example (or any integer value), and when you strech your vertex in the texture coordinate view, use exactly the same width:</li></ul><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSqGXtW0MOkLpFlISxcMPkcbfVqog2W2gTFuSW0GAu2SVOVs7CBeKvrnA6Yih1-3oehTC5NEio1KVjRLwYX_g7xFYimn0uPqLXJLFWh5jj8JNvsDEAhyphenhyphen6aC2yU7p388UmE45dPt3zsfEE/s1600-h/4.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSqGXtW0MOkLpFlISxcMPkcbfVqog2W2gTFuSW0GAu2SVOVs7CBeKvrnA6Yih1-3oehTC5NEio1KVjRLwYX_g7xFYimn0uPqLXJLFWh5jj8JNvsDEAhyphenhyphen6aC2yU7p388UmE45dPt3zsfEE/s400/4.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597640328841746" border="0" /></a><br /><br /><ul><li>Then exit the texture coordiante panel</li></ul><br /><br /><br /><br />Now we will use this part of the model as the base for copy-paste geometry of the tree.<br />If you will, you can do another cylinder with less sides, for futures branches, just repeat the process.<br /><br /><br />So...<br /><ul><li>Select the whole model (you know how to do it now)</li><li>Enter the menu Geometry -> Duplicate (shortcut Ctrl+D)</li><li>Choose the move tool, and move away the freshly duplicated mesh, as said before, it will be used for copy-paste everytime, so keep this one unchanged. Move it so it will not be in any of the front, right or top view of your main model, so it will not interfere.</li></ul><br /><br />Now we will work on the trunk. First we will adjust size.<br /><br /><ul><li>Select a line of vertex of your trunk in the front view (I mean a circle of vertex in a 3D sens, but in the front view they are in a line... the vertex that split the cylinder into segment)</li><li>Choose the scale tool, and rescale those vertex IN THE TOP VIEW using "keep 2D ratio" option</li></ul><br />The base of the trunk have to be wider. After you do it several time, you get that:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRID6VonRICI6zQZlUWZVmU9q3MBrOTJWVz44BzmdoGDkBcwa5FFdQNYzLsxnH3nfxpejVHAbN7khA1a0tzf7129tpbO5evcoq5wDFFe6OlNWfsqqlm4ZDor6hySjPtYPryxC8bo2iXoo/s1600-h/5.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRID6VonRICI6zQZlUWZVmU9q3MBrOTJWVz44BzmdoGDkBcwa5FFdQNYzLsxnH3nfxpejVHAbN7khA1a0tzf7129tpbO5evcoq5wDFFe6OlNWfsqqlm4ZDor6hySjPtYPryxC8bo2iXoo/s400/5.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597588419382290" border="0" /></a><br /><br /><br />Now we have to twist and bend a bit this trunk.<br /><br /><ul><li>Select a circle of vertex (front view)</li><li>Move a bit the whole circle in the top view</li><li>Repeat that for other circle</li></ul><br />You should get something like that:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHXfHLMvTXhIJCONDT73kEyIwbh_2mw73Oo0e2dhPnlm1QPN9XpaJ3ujMgR92_-5eCwxLWN6KZ2JcvMJ1QqKLiZsJOGPDAqmvI_qdR13MC4aw-7j32eDtH6iOGIi0kXYkq1M2QRGiopxw/s1600-h/6.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHXfHLMvTXhIJCONDT73kEyIwbh_2mw73Oo0e2dhPnlm1QPN9XpaJ3ujMgR92_-5eCwxLWN6KZ2JcvMJ1QqKLiZsJOGPDAqmvI_qdR13MC4aw-7j32eDtH6iOGIi0kXYkq1M2QRGiopxw/s400/6.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597523270414706" border="0" /></a><br /><br /><br />When it looks good, we will decide to create branches (just duplicate the mesh that you have keep for copy-paste).<br /><br />Deform it with the same technics, scale it so it will be thiner and smaller than the trunk. You can eventually remove 1 or 2 segment (select vertex of its base and remove them).<br /><br />When you have done it, just select it, rotate it and move it so its base will be "melted" somewhere in the trunk:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio8tDUrDZdEvSXGo4QmZl5wMJ5K03AgXI_-663XxzJGaSB02IZy9MKtCtLlUIx1ji1QfwNKzl7bM5laZOiUTcAmgAaNZ5UWotDnvP9oUoPpUUhVwtrzC9DlTZdAt83RFoyLV3KFvTBHyE/s1600-h/7.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio8tDUrDZdEvSXGo4QmZl5wMJ5K03AgXI_-663XxzJGaSB02IZy9MKtCtLlUIx1ji1QfwNKzl7bM5laZOiUTcAmgAaNZ5UWotDnvP9oUoPpUUhVwtrzC9DlTZdAt83RFoyLV3KFvTBHyE/s400/7.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597455578409298" border="0" /></a><br /><br /><br /><br />Repeat it as many time you want, but keep an eyes on the number of face your model have, most of time 3 or 4 branches looks fine.<br /><br />Got something like that after few minutes:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqXwjco0g1YDz4_bag8YKAyQh22_VDExNxOzXOe1ikWmsER44bD-Z92EvC7s-7NiKV6e4v_gMdkKpAhXUzmctsLhFdc70cIM_mFvCbyhN9HJs6kHxMyTU0yYxaL-OMzCPj7-VALg8JUx4/s1600-h/8.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqXwjco0g1YDz4_bag8YKAyQh22_VDExNxOzXOe1ikWmsER44bD-Z92EvC7s-7NiKV6e4v_gMdkKpAhXUzmctsLhFdc70cIM_mFvCbyhN9HJs6kHxMyTU0yYxaL-OMzCPj7-VALg8JUx4/s400/8.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597395756371874" border="0" /></a><br /><br /><br /><br />Now the foliage. There are various way to get foliage, I will do the simpliest one cause this tutorial start to be very very long...<br /><br />Open the material panel, create a new material named "foliage", browse texture (in this tutorial, I use "textures/joekari_plant/plant_pink_foliage1.tga").<br />Don't forget to open model's meta data and add the key/value pair: "MD3_PATH_foliage" / "textures/joekari_plant/".<br /><br />This texture has an alpha channel, so we don't really have to bother with the form of the foliage.<br /><br />Now...<br /><ul><li>Choose the "create ellipsoïd tool", in the tool option, enable "sphere" and "from center", set smoothness to "1" (80 faces)</li><li>In a 2D view drag a sphere, away form your trunk and branches</li><li>When your sphere is still selected, enter the group manager (Ctrl+G), create a new group named "foliage", choose texture "foliage", and click "add (faces) to group", then click "ok" and exit the group manager</li><li>Choose the "create projection tool", set the type to "sphere"</li><li>Drag the spherical projection inside your sphere mesh, the center of the projection should match the center of your mesh</li><li>Rotate your projection so the projection axis is vertical (you will see why few point later)</li><li>Select your spherical mesh and go to the menu "Material -> Edit projection", inside the panel click "add faces to projection" and close that panel</li><li>Delete the projection (same as in the begining of the tutorial)</li><li>You can eventually enter the texture coordinate panel to adjust the texturing scale (a bit more complicated to get it work for a sphere than for a cylinder)</li><li>You can see that some face have the texture really streched, and bad-looking, so, that why you have I advise you to rotate the axis of the projection verticaly, know you just have to select the 2 extremes vertexes and delete them.</li></ul><br />You will get something like that:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnhDfAxzknTeJfReYr-D0cj14VTfGt817p2ZsUnCJ3lbJGEuIiUrMjXHsdpGpOpoPa0eG9g3mO-9DjQ8PNzu3LJLeT04ML06Vn_yDThgyoWJG4UpkQWh3hRVinNnC-HT4zS_r9v-jPhAs/s1600-h/9.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 278px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnhDfAxzknTeJfReYr-D0cj14VTfGt817p2ZsUnCJ3lbJGEuIiUrMjXHsdpGpOpoPa0eG9g3mO-9DjQ8PNzu3LJLeT04ML06Vn_yDThgyoWJG4UpkQWh3hRVinNnC-HT4zS_r9v-jPhAs/s400/9.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597316080218258" border="0" /></a><br /><br /><br />Now we are close to the end... Just copy-paste your foliage, every where you want, just change the geometric-scale to your need, rotate them, and fix them in the middle of a branches... and so on... Make larger foliage sphere that overlap and intersect smaller, deform them, do things some randomness touch...<br /><br />Finally... remove useless geometry (those used for copy-paste), and move the whole model so the base of the tree match the origin, it will be easier for mapping in Radiant this way.<br /><br />The result :<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpt-Es1m6cVAqoSXrQSwZsARpvxOER_lFegaXQATqmAmu5GDwDhsoRjQXnP6wjhQ7CXwUrpqhiaYFwAH_a3x_t6FosjFIZqbhGjNbd_if4lTAVL9UsJsYRS4r9FqDvTgFIZ2lY2Gzr4ak/s1600-h/10.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 278px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpt-Es1m6cVAqoSXrQSwZsARpvxOER_lFegaXQATqmAmu5GDwDhsoRjQXnP6wjhQ7CXwUrpqhiaYFwAH_a3x_t6FosjFIZqbhGjNbd_if4lTAVL9UsJsYRS4r9FqDvTgFIZ2lY2Gzr4ak/s400/10.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597246283407218" border="0" /></a><br /><br /><br /><br /><br /><ul><li>When it is done, you just have to save your model in .md3 format</li><li>Open Radiant, import it the way you do and compile a map</li></ul><br /><br />The result, in game:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipyH1J18S67gu45KBHWdzlq0j2DSNS9ydJZ_xI5pxnjrpOuxb8RMzCPqUVNyKJ6znhBJQb1OLe9mu1ZwQDWmB75QsVcnG4SP0DqjL7MGvO7Uf_aCFgPYgbU-mqQy6wW57pA9fj60_yPdg/s1600-h/11.jpg"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 365px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipyH1J18S67gu45KBHWdzlq0j2DSNS9ydJZ_xI5pxnjrpOuxb8RMzCPqUVNyKJ6znhBJQb1OLe9mu1ZwQDWmB75QsVcnG4SP0DqjL7MGvO7Uf_aCFgPYgbU-mqQy6wW57pA9fj60_yPdg/s400/11.jpg" alt="" id="BLOGGER_PHOTO_ID_5444597184688054338" border="0" /></a><br /><br /><br />Okey, it is not perfect, but it is good enough for a first Misfit Model 3D tutorial ;)<br />To improve the effect, you need a better foliage texture (I simply get the first free foliage texture that I have found on google, and try to make a decent alpha channel on it).<br /><br />Anyway...<br /><br />All the basics tricks are here.Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com1tag:blogger.com,1999:blog-2415065267446558172.post-63968697926396153462009-01-23T07:16:00.000-08:002009-01-23T09:21:45.370-08:00Using far-clipping part 3<span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">List of all clipping form</span></span><br /><br />In all the following example, "<span style="font-style: italic;">a</span>" and "<span style="font-style: italic;">b</span>" are arbitrary integer.<br />The first integer "<span style="font-style: italic;">a</span>" always affect the most general setting of the form, while the seconde integer "<span style="font-style: italic;">b</span>" (if any) affect an alternate setting of the form. If the form has <span style="font-style: italic;">x</span>, <span style="font-style: italic;">y</span> and <span style="font-style: italic;">z</span> variations, the second integer "<span style="font-style: italic;">b</span>" (if any) is always a distance along this axis. For example, "<span style="font-style: italic;">box_y 128 256</span>" means 128 along <span style="font-style: italic;">x-axis</span> and <span style="font-style: italic;">z-axis</span>, and 256 along <span style="font-style: italic;">y-axis</span>.<br /><br />Forms that have <span style="font-style: italic;">X</span>, <span style="font-style: italic;">Y</span> and <span style="font-style: italic;">Z</span> axis variations are only explained for the Z-axis one, but it is easy to figure out how does it work for X-axis and Y-axis variation ;)<br /><br />The left part of each image is for the side view, the right part is for the top view.<br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">sphere</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjt25rTE8tCtzIrw5VKN0MteiMNSzm2liVpYp-_TbZzEh6AtzOeEXc8wEhFPFVIPS0V5fRUVgA9gW5F2hw5mKxGCxurQiDymuvrhqkQkajKB9fvR34wVybsHRtuSUpZZi_KDvmWQbuthAM/s1600-h/sphere.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjt25rTE8tCtzIrw5VKN0MteiMNSzm2liVpYp-_TbZzEh6AtzOeEXc8wEhFPFVIPS0V5fRUVgA9gW5F2hw5mKxGCxurQiDymuvrhqkQkajKB9fvR34wVybsHRtuSUpZZi_KDvmWQbuthAM/s320/sphere.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531455488216690" border="0" /></a><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">cube</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpbjGv7QVRC_NiD7mk3yybhY-ffOBhQxMq982yxk1M9q-BtKGCIZsFPC-a9JolD-5mqQUvi0Gv9x-Vx7MYkZbBVerluBDpKUxpXio9jvgpHbjmh3GyfrEnvMCHUvgPcCb58ZvUUl8MHOA/s1600-h/cube.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpbjGv7QVRC_NiD7mk3yybhY-ffOBhQxMq982yxk1M9q-BtKGCIZsFPC-a9JolD-5mqQUvi0Gv9x-Vx7MYkZbBVerluBDpKUxpXio9jvgpHbjmh3GyfrEnvMCHUvgPcCb58ZvUUl8MHOA/s320/cube.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531450920898354" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">ellipse_x, ellipse_y, ellipse_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7Cv3Pa4J7g00WsUZcJB_szo4EA_w3uywRRUCQCB9frK18hvOcCV9Foo7lw-IzpIn88DUCt6Ui8UjAN-GAcfLpmR8osE7XCQPet0fru6CXwKQi1B81CSwA2gIcNT56Mfe3YYJdLHTYk2I/s1600-h/ellipse_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7Cv3Pa4J7g00WsUZcJB_szo4EA_w3uywRRUCQCB9frK18hvOcCV9Foo7lw-IzpIn88DUCt6Ui8UjAN-GAcfLpmR8osE7XCQPet0fru6CXwKQi1B81CSwA2gIcNT56Mfe3YYJdLHTYk2I/s320/ellipse_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531446560951506" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">box_x, box_y, box_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj82m5PZD-xzWstAJbemdPTqiVHqOkPfHEyj2HCIf5p-JaepYIktA7VLbZ8Qf62AbiYDNv1hypQCWH9lQvZidPVJNQdG-SghIlYLcml_btpQHSRoWBrAqhZAfcmF9Nar6-j1lN50Do-3No/s1600-h/box_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj82m5PZD-xzWstAJbemdPTqiVHqOkPfHEyj2HCIf5p-JaepYIktA7VLbZ8Qf62AbiYDNv1hypQCWH9lQvZidPVJNQdG-SghIlYLcml_btpQHSRoWBrAqhZAfcmF9Nar6-j1lN50Do-3No/s320/box_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531443425857442" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">cylinder_x, cylinder_y, cylinder_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt0oOXuljkTVdqvVfB-vU-3VNizkba0pAqEwXJ4b-GQKOv9k3_FmMTEAHOnCil8nkBn0Fq-We-2mN3dcLsk0Fa3_xY_m_3hPURsTkizMUdAAJzPgwRVjBzpnRui0k8zDbKo3P_N8zO5Us/s1600-h/cylinder_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt0oOXuljkTVdqvVfB-vU-3VNizkba0pAqEwXJ4b-GQKOv9k3_FmMTEAHOnCil8nkBn0Fq-We-2mN3dcLsk0Fa3_xY_m_3hPURsTkizMUdAAJzPgwRVjBzpnRui0k8zDbKo3P_N8zO5Us/s320/cylinder_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294540323224759618" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">cone_x, cone_y, cone_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb5q-Vj57Q1idThjSOywewzYF8gNJF38ibMS1UHy6e7_3zt24HFXHn_N-4cK9sruNAVYBlzsEHJXIN40bTp5v1Jrdp6a0226aa1MWeOvXIEWQKAzGyN0XQu4-4AcXNNG0L0Rtn51jfB4k/s1600-h/cone_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb5q-Vj57Q1idThjSOywewzYF8gNJF38ibMS1UHy6e7_3zt24HFXHn_N-4cK9sruNAVYBlzsEHJXIN40bTp5v1Jrdp6a0226aa1MWeOvXIEWQKAzGyN0XQu4-4AcXNNG0L0Rtn51jfB4k/s320/cone_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531435954928818" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">pyramid_x, pyramid_y, pyramid_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAvnXr2xb3Es0LEpTdVTydAgBF60wJXo_W_0WhlgBf4e0HLdvADND-uNyY95PRfjiTanYsZ9_a-xHGMW08SY1dxyyMske_CRfc4pgG_EbIBaKCoC2y8Th6kJLkOCbniksCjRNt2xVLpeE/s1600-h/pyramid_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAvnXr2xb3Es0LEpTdVTydAgBF60wJXo_W_0WhlgBf4e0HLdvADND-uNyY95PRfjiTanYsZ9_a-xHGMW08SY1dxyyMske_CRfc4pgG_EbIBaKCoC2y8Th6kJLkOCbniksCjRNt2xVLpeE/s320/pyramid_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531998904411634" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">circle_infinite_x, circle_infinite_y, circle_infinite_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3TvDMRBic3CJBO-exlpUa7Qt0ZuT0LR-Zy4H4iRJf2MTG_ypinxfvodx4jcaUd6Mu0UH3Xnsu3jJ4_p7w46tU0K9FHGZqoR_sF-DEzdl2Xwu3pf0xeWCcAYc7aPM3YaiwQeR5vI_rGqY/s1600-h/circle_infinite_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3TvDMRBic3CJBO-exlpUa7Qt0ZuT0LR-Zy4H4iRJf2MTG_ypinxfvodx4jcaUd6Mu0UH3Xnsu3jJ4_p7w46tU0K9FHGZqoR_sF-DEzdl2Xwu3pf0xeWCcAYc7aPM3YaiwQeR5vI_rGqY/s320/circle_infinite_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531996807025922" border="0" /></a><br /><br /><br /><br /><span style="font-weight: bold; font-style: italic; color: rgb(255, 204, 51);">square_infinite_x, square_infinite_y, square_infinite_z</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghkRbEWbop3yTUx9NglHx1lfTFXaWGeKVxDIsfbnf2tcT-rr6Y4AhSQQf7PPdGwbkbuhQMDA6cqn67B8B7CX90CHZOHlk-5ZVMfzS0VywNJJnerP3M8srAUELwTyabdsLXAdyFUeW3RQM/s1600-h/square_infinite_z.jpg"><img style="cursor: pointer; width: 320px; height: 106px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghkRbEWbop3yTUx9NglHx1lfTFXaWGeKVxDIsfbnf2tcT-rr6Y4AhSQQf7PPdGwbkbuhQMDA6cqn67B8B7CX90CHZOHlk-5ZVMfzS0VywNJJnerP3M8srAUELwTyabdsLXAdyFUeW3RQM/s320/square_infinite_z.jpg" alt="" id="BLOGGER_PHOTO_ID_5294531993286009986" border="0" /></a>Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com0tag:blogger.com,1999:blog-2415065267446558172.post-79148633989309658162009-01-21T12:11:00.000-08:002009-01-23T07:15:38.033-08:00Using far-clipping part 2: with grass<span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">What is wrong with the sphere clipping form</span></span><br /><br />Let's say you have made a whole terrain with a lot of func_static, each func_static consists in few grass brushes. You have used "<span style="font-style: italic;">sphere 512</span>" for each <span style="font-style: italic;">farclip</span> key. In this example, we only display 3 grass func_static:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib23sWAhXWBk7i8fgZDjmy64VRRrE7rC9-uKgQReGkcXZCQHoQVVxaThMOUj80818Gj7x7ddGSMj7_mphxWJkx4jAOBHggcaABusWGT5_t98OVXJyFJ7K80Fy19JiQDLMaOOyi55Bvx4M/s1600-h/grass1.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib23sWAhXWBk7i8fgZDjmy64VRRrE7rC9-uKgQReGkcXZCQHoQVVxaThMOUj80818Gj7x7ddGSMj7_mphxWJkx4jAOBHggcaABusWGT5_t98OVXJyFJ7K80Fy19JiQDLMaOOyi55Bvx4M/s320/grass1.jpg" alt="" id="BLOGGER_PHOTO_ID_5293843244312350610" border="0" /></a><br />For each point of view:<br /><ul><li>A. can see grass 1 and 2, that's good because 3 is too far, and behind 1, 2, and all grass brushes between 1 and 2: it is probably impossible to see it.</li><li>B. can only see 1... just elevating the point of view make 2 too far away... this is not really fine...</li><li>C. is so high that all 3 grass brushes are too far and aren't displayed... that's not fine.<br /></li></ul>A grass shader usually consists in an alpha-blending one. Alpha-blending needs more video-card render-power at close range (because many pixels/texels are involved) than at long-range, and if your brush is seen from above, the number of pixels/texels involved are reduced even more.<br />So what we need is something that clip close if we stand on the ground, but something that clip farther if we jump, or climb some crate, or join spec...<br /><br />Good news: the "<span style="font-style: italic;">cone_z</span>" clipping form is just designed for that!<br />It looks like that:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj35AkCvHAGBZ2lFztNy45cm_fRgMenA4fPyCCeVIV2YLjfk4nyq4ux3VSsqDNH6S8sJL2lSpjyd6aRpnNEnPDyVdSf6mbFF0gWcbMVGQxNV64xMJo3fC6j9H0KCzs_ZHwYZnfuytU6MDg/s1600-h/sphere_vs_cone.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj35AkCvHAGBZ2lFztNy45cm_fRgMenA4fPyCCeVIV2YLjfk4nyq4ux3VSsqDNH6S8sJL2lSpjyd6aRpnNEnPDyVdSf6mbFF0gWcbMVGQxNV64xMJo3fC6j9H0KCzs_ZHwYZnfuytU6MDg/s320/sphere_vs_cone.jpg" alt="" id="BLOGGER_PHOTO_ID_5293843239696976882" border="0" /></a><br /><br />Now if we apply this to the previous example, we get this:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK_kUiShVPlDCGmz-X27eNKXaLTfbmgV3cRBqkmc2gHYpbW1A66925A3acGPI4VbeoPavXY68yiEVCyNEBZCbMPeN9Q9jArjvgPBsJ2KhYkVa8AdAzT9J6vcZxxKRmrOI4a9PxLCWQb8U/s1600-h/grass2.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK_kUiShVPlDCGmz-X27eNKXaLTfbmgV3cRBqkmc2gHYpbW1A66925A3acGPI4VbeoPavXY68yiEVCyNEBZCbMPeN9Q9jArjvgPBsJ2KhYkVa8AdAzT9J6vcZxxKRmrOI4a9PxLCWQb8U/s320/grass2.jpg" alt="" id="BLOGGER_PHOTO_ID_5293843236492201282" border="0" /></a><br />For each point of view:<br /><ul><li>A. can see grass 1 and 2, that's good because 3 is too far, and behind 1, 2, and all grass brushes between 1 and 2: it is probably impossible to see it.</li><li>B. and C. can see 1, 2 and 3, and that's good because 3 is no longer hidden behind 1 and 2.<br /></li></ul><br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">More about the cone_* clipping form</span></span><br /><br />Using <span style="font-style: italic;">cone_z</span>, the cone will have <span style="font-style: italic;">Z</span> as its axis. You can use <span style="font-style: italic;">cone_x</span> or <span style="font-style: italic;">cone_y</span> if you want your cone along <span style="font-style: italic;">X</span> or <span style="font-style: italic;">Y</span> axis.<br /><br />While using cone_z, the first number is the clipping distance that occurs if your point of view has the same z-coordinate than the origin of your <span style="font-style: italic;">func_static</span>.<br />The second number describe how fast the radius of the clipping distance grow up.<br />If you specify "cone_z <span style="font-style: italic;">x-value</span> <span style="font-style: italic;">y-value</span>", you get this (here <span style="font-style: italic;">x-value</span> = <span style="font-style: italic;">y-value</span>):<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR1k2xszLKnTG_gXWWmiKNZzrPIm-wYDn0sgh2D7cDpwM5WVDSubE743G4fPeGQ5VI6VBGSuwqeFKutEyBfAyOPUkepqldaHX6pMJpnSq3yZQKECmbJ5vlGNjgvtYJBjJ_qdWACHXiemY/s1600-h/cone.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR1k2xszLKnTG_gXWWmiKNZzrPIm-wYDn0sgh2D7cDpwM5WVDSubE743G4fPeGQ5VI6VBGSuwqeFKutEyBfAyOPUkepqldaHX6pMJpnSq3yZQKECmbJ5vlGNjgvtYJBjJ_qdWACHXiemY/s320/cone.jpg" alt="" id="BLOGGER_PHOTO_ID_5293843233180775458" border="0" /></a><br />For each game-unit you move up, the clipping radius grow by one game-unit.<br /><br /><br />Setting <span style="font-style: italic;">y-value</span> to twice the <span style="font-style: italic;">x-value</span>, you get something like that:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCuLMz4OeYg_fRBZ05hOySP3Hsme1FfGrGH6bVaIIyQYDMqzZI2ouwRQBl5d_gtr1Ht6dI0-g6xurSmg3mwcUyUgt0BOlF0dSBl3CCiN2sZgQ8h9OjBCi1tIvRKqX2OLNonG73QUhkEis/s1600-h/cone2.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCuLMz4OeYg_fRBZ05hOySP3Hsme1FfGrGH6bVaIIyQYDMqzZI2ouwRQBl5d_gtr1Ht6dI0-g6xurSmg3mwcUyUgt0BOlF0dSBl3CCiN2sZgQ8h9OjBCi1tIvRKqX2OLNonG73QUhkEis/s320/cone2.jpg" alt="" id="BLOGGER_PHOTO_ID_5293843233819220226" border="0" /></a><br />This time, for each game-unit you move up, the clipping radius grow by two game-units.<br /><br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold; color: rgb(153, 0, 0); font-style: italic;">Few advices</span></span><br /><br />So if your grass are small and use the same color than your ground texture, I suggest using a narrow cone. If your grass is really small a simple sphere-clipping will do it better.<br /><br />If your grass are rather big, using a cone_z with the first argument equal to the second is good.<br /><br />If your grass is as big as human, I suggest using a wide cone. I have made some test with this setting "<span style="font-style: italic;">cone_z 512 2048</span>", that was looking good. However, I strongly suggest you to leave some grass brushes here and there into the worldspawn (meaning not far-clipped): this will not really cost framerate drop, but this will looks definitively better.<br /><br /><br /><br />Oh, and have you noticed that I have used numbers like <span style="font-style: italic;">512</span> or <span style="font-style: italic;">2048</span>? This is because all value are rounded to the closest multiplier of 64 (for data compression).Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com0tag:blogger.com,1999:blog-2415065267446558172.post-46103299758951816522009-01-20T09:20:00.000-08:002009-02-06T03:41:10.886-08:00Using far-clipping, part 1<span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >Why using far-clipping</span><br /><br />Far-clipping is commonly used in every game that take place outdoor. Most of time, grass geometry are clipped (meaning not rendered) every time it is too far away from the camera's point of view.<br />This is used for performance issue, cause your CPU doesn't have to send this geometry to your video card, and your video card don't have to render them.<br /><br />Far-clipping can be used in place where fails the famous Q3's <span style="font-style: italic;">Potential Visibility Set</span> (known as <span style="font-style: italic;">PVS</span>, computed by <span style="font-style: italic;">q3map2</span> at <span style="font-style: italic;">VIS stage</span>). The PVS is very efficient indoor, for game just like Q3, with map that consist of rooms and corridors. Far-clipping is efficient outdoor, for big landscape, allowing nice details close to the camera, while skipping those that are too far away. It can be used too if you have some detailed objects inside a house that can't be skipped using the VIS-stage because your house has too many windows, or this object stand in front of one of them... so specifying a clipping distance allow you to remove it from the render scene, if farther than the clipping distance, only few pixels of this object remain visible.<br /><br />Well, I'm sure most of you are thinking "<span style="font-style: italic;">wait a minute, I have never seen far-clipping in Q3 engine</span>", and you are right... But I have just coded this for Smokin' Guns. And that will be available with the next release! (if you can't wait, just compile your own qvm from smokinguns.sourceforge.net)<br /><br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">Basic tutorial of far-clipping</span></span><br /><br />Open your favorite testbox map with Radiant.<br />Create some brushes, add some textures to them.<br />Create an origin brush (a brush with the texture: common/origin). This origin brush is _very_ important, cause this will be the reference for computing distance to the camera.<br />Select all your newly created brushes and the origin brush, and turn them into a <span style="font-style: italic;">func_static</span> (right-click, choose <span style="font-style: italic;">func->func_static</span> in the menu entry).<br /><br />Now open the entity window (hit the '<span style="font-style: italic;">n</span>' key). Add a new key for this entity: "<span style="font-style: italic;">farclip</span>". Enter a value for this key: "<span style="font-style: italic;">sphere 800</span>" (and hit '<span style="font-style: italic;">return</span>'). You should have something that looks like that:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLjOwhANdSau2FI_HS9YqB1XYkxDkzP2lu9SReF19oyOvr4S2MxIadMBd6P1A1Cyw6GQtPCjlinjCQCAyilSqtfl8FCkgArGeFE-7rVf6t13QJGKj5xNALv3w4vMtoxgZdeFbenzgYA64/s1600-h/farclip01.jpg"><img style="cursor: pointer; width: 320px; height: 259px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLjOwhANdSau2FI_HS9YqB1XYkxDkzP2lu9SReF19oyOvr4S2MxIadMBd6P1A1Cyw6GQtPCjlinjCQCAyilSqtfl8FCkgArGeFE-7rVf6t13QJGKj5xNALv3w4vMtoxgZdeFbenzgYA64/s320/farclip01.jpg" alt="" id="BLOGGER_PHOTO_ID_5293463768000141714" border="0" /></a><br /><br />Compile your map as you usually do, launch the game, and look at your <span style="font-style: italic;">func_static</span> entity: every time you get close to it, it appears, every time you move far away from it, it disappears...<br /><br />Setting farclip to "sphere 800" means that your <span style="font-style: italic;">func_static</span> is magically clipped every time you are farther than 800 game units (same unit used by Radiant) from it.<br /><br />Here what you get in-game:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz0dGSlFL2UlSfONbpD0ygCOOwe9kWVJc91bVfFPU1sXA-IrQ8A16ZQ20u3OpfcaambHznqRrtzXu1BvQueCPtj7H8TjWekBM3x6UF1J_664maKq3N8sozSHdBiQc2bmEsMLOJTfuCNTA/s1600-h/shot0011.jpg"><img style="cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz0dGSlFL2UlSfONbpD0ygCOOwe9kWVJc91bVfFPU1sXA-IrQ8A16ZQ20u3OpfcaambHznqRrtzXu1BvQueCPtj7H8TjWekBM3x6UF1J_664maKq3N8sozSHdBiQc2bmEsMLOJTfuCNTA/s320/shot0011.jpg" alt="" id="BLOGGER_PHOTO_ID_5293463772992122434" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKoEQ_bmmE_UA4S1yTbFNksr0c8dH2N9F2mha4zYAjUgEnkQY_ttMYiMqx3IG8ETOMm-iBJIGPPBv8jLVfpeKpoJYCOw-4Kc72fFb1CGTmmAEokT1vn9Zfhd6kEXPURLq7mnuT_hDcCqg/s1600-h/shot0012.jpg"><img style="cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKoEQ_bmmE_UA4S1yTbFNksr0c8dH2N9F2mha4zYAjUgEnkQY_ttMYiMqx3IG8ETOMm-iBJIGPPBv8jLVfpeKpoJYCOw-4Kc72fFb1CGTmmAEokT1vn9Zfhd6kEXPURLq7mnuT_hDcCqg/s320/shot0012.jpg" alt="" id="BLOGGER_PHOTO_ID_5293463775414066866" border="0" /></a><br />You may want your func_static to cast shadows (unlike those screenshots), just open the entity window, and add the key "<span style="font-style: italic;">_cs</span>" (or "<span style="font-style: italic;">_castshadows</span>", it is the same) with a value of <span style="font-style: italic;">1</span>.<br /><br />If you want a cubic clipping, change the value of the <span style="font-style: italic;">farclip</span> key to "cube 800".<br />Here is the clipping frontier you get:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP4SMJY6F0dJyx1sTIiTf08zAS9AOisvpM7jJAw4GEfCWWXnEol7TAWA-nMDN5C-nxcANSQpPsctmrJqSI8z7FXaud_48DMuNDrLsi8rkJs5W8nNUDPeL_P-8-mm17RgGL_jbt5BdOGJg/s1600-h/farclip04.jpg"><img style="cursor: pointer; width: 320px; height: 286px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP4SMJY6F0dJyx1sTIiTf08zAS9AOisvpM7jJAw4GEfCWWXnEol7TAWA-nMDN5C-nxcANSQpPsctmrJqSI8z7FXaud_48DMuNDrLsi8rkJs5W8nNUDPeL_P-8-mm17RgGL_jbt5BdOGJg/s320/farclip04.jpg" alt="" id="BLOGGER_PHOTO_ID_5293464778083878114" border="0" /></a><br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">How to use far-clipping with a model</span></span><br /><br />For instance only <span style="font-style: italic;">func_static</span> support far-clipping. If you want to attach a model as <span style="font-style: italic;">func_static</span>, you have 2 ways of doing it. First you specify this model in a "<span style="font-style: italic;">model2</span>" key you add to a <span style="font-style: italic;">func_static</span> entity, but this is weird cause you can't adjust anything with that.<br />The second way I discovered recently just consists to <span style="font-style: italic;">target</span> your <span style="font-style: italic;">func_static</span>. It is easy, just deselect all, select your model, select a brush which is part of the <span style="font-style: italic;">func_static</span>, and hit <span style="font-style: italic; font-weight: bold;">Ctrl-K</span>: an arrow will be displayed from your model to the <span style="font-style: italic;">func_static</span> entity. If you open the entity window, you will see that your <span style="font-style: italic;">func_static</span> has now a key named "<span style="font-style: italic;">targetname</span>" with the same value that you will found in your model's entity window under the "<span style="font-style: italic;">target</span>" key. Repeat this for all models you want to be part of the func_static entity (don't forget to deselect all by pressing the <span style="font-style: italic;">escape</span> key before starting to include the next model).<br /><br /><span style="font-weight: bold; color: rgb(255, 204, 51);">Note that including one or more models to an entity works for most of entity type</span> (including for example SG's specific entity like <span style="font-style: italic;">func_door_rotating</span>).<br /><br />Now if you want that your models cast shadows, don't forget to add "<span style="font-style: italic;">_cs</span>" key with a value of <span style="font-style: italic;">1</span> to your <span style="font-style: italic; font-weight: bold;">func_static</span> entity!!! If you don't do that, even if you specify <span style="font-style: italic;">_cs=1</span> in your model pseudo-entity window, it will not work.<br /><br />Here screenshots of the entity window for the func_static (left) and for the model window (right):<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2hlLvYXN71xWiYFHFmTNHDSjQ_ihocNiQ7RSwmpPanLFncrh1OhWmYoZoJA4B0OHukIh-m4QDrN3u3NEyo9NnLBVKZ6do0vOaURAHDkQHBy9BUZwcf6dx9gX3hinQTSBMgHrvhIgBYCM/s1600-h/farclip02.jpg"><img style="cursor: pointer; width: 320px; height: 259px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2hlLvYXN71xWiYFHFmTNHDSjQ_ihocNiQ7RSwmpPanLFncrh1OhWmYoZoJA4B0OHukIh-m4QDrN3u3NEyo9NnLBVKZ6do0vOaURAHDkQHBy9BUZwcf6dx9gX3hinQTSBMgHrvhIgBYCM/s320/farclip02.jpg" alt="" id="BLOGGER_PHOTO_ID_5293464787391886770" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3npZkq9pxwK9SVheGTj1-WqeSWAF222aFswZyuW_phxvCJaYzXf7NBReJWH0cga0RC33byq2oZnYkVZ2aMoLTADklPSYoxrF7DrDj1EWCVvo30I3c3F4WAi5oIkN3Zd7GGPcAgmZb0Eo/s1600-h/farclip03.jpg"><img style="cursor: pointer; width: 320px; height: 259px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3npZkq9pxwK9SVheGTj1-WqeSWAF222aFswZyuW_phxvCJaYzXf7NBReJWH0cga0RC33byq2oZnYkVZ2aMoLTADklPSYoxrF7DrDj1EWCVvo30I3c3F4WAi5oIkN3Zd7GGPcAgmZb0Eo/s320/farclip03.jpg" alt="" id="BLOGGER_PHOTO_ID_5293464778302343970" border="0" /></a><br /><br />Here what you get in-game:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9UoGTBrxeGQ3ZXyRgqU6gcA7nRXbkk6K8uDC0Ymixisz1ayLhO9fwwYeO1ahOaqEWimS-3bdwkjMVvWhLc6oPudP4te_p-tsrhnWg5_XLzKrua1m878AVXOV2_S9ziRtgDGxtIsw3qtE/s1600-h/shot0013.jpg"><img style="cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9UoGTBrxeGQ3ZXyRgqU6gcA7nRXbkk6K8uDC0Ymixisz1ayLhO9fwwYeO1ahOaqEWimS-3bdwkjMVvWhLc6oPudP4te_p-tsrhnWg5_XLzKrua1m878AVXOV2_S9ziRtgDGxtIsw3qtE/s320/shot0013.jpg" alt="" id="BLOGGER_PHOTO_ID_5293464769707876946" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM2LzPLw2co3nEfE6EUcT1kQnY17FEuUQ7v782ziFXQ_6b26wRfuyuwihPj7Udbt-OpZZpphv_L_O-K531WZV2YGkSr3NszXIVJ_qNJ6XoYs1ZN18ic9MdFiuvwkEfuQ_7I5Jk4o3aoNM/s1600-h/shot0014.jpg"><img style="cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM2LzPLw2co3nEfE6EUcT1kQnY17FEuUQ7v782ziFXQ_6b26wRfuyuwihPj7Udbt-OpZZpphv_L_O-K531WZV2YGkSr3NszXIVJ_qNJ6XoYs1ZN18ic9MdFiuvwkEfuQ_7I5Jk4o3aoNM/s320/shot0014.jpg" alt="" id="BLOGGER_PHOTO_ID_5293464765846307442" border="0" /></a><br /><br /><br />Of course, those example look stupid, but here an example where far-clipping is usefull, in the big house of Alamo, there is a lot of object that have many polys:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFzT0UmKtduMQlSlTjyvpAWUSMXa6D8oGTFLPMzxhA1S3tuSZz7_E6tgwjardst4hWlSN0A_X4Fpz9S8Uz5hzRftInfIPV_sxRCCjzlp-N4jnUbL1VELwsO-GBdfHmSP_tnELAOcgwm_c/s1600-h/shot0015.jpg"><img style="cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFzT0UmKtduMQlSlTjyvpAWUSMXa6D8oGTFLPMzxhA1S3tuSZz7_E6tgwjardst4hWlSN0A_X4Fpz9S8Uz5hzRftInfIPV_sxRCCjzlp-N4jnUbL1VELwsO-GBdfHmSP_tnELAOcgwm_c/s320/shot0015.jpg" alt="" id="BLOGGER_PHOTO_ID_5293465616862287634" border="0" /></a><br /><br />From these point of view they are really small, but still have the same amount of tris:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSEfqMJpcHbIzkvojDBrTBWVrr92KFPr_6wA1y2mlCqqq7U3pL7X9TFMvw99R-9QkBQ7M4P22i3dLFfAIkpswwtyCkDn03djMrt7-L8bOdvispF5KpEanfa5c3CFAt_QljYY1pHR68aY/s1600-h/shot0016.jpg"><img style="cursor: pointer; width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSEfqMJpcHbIzkvojDBrTBWVrr92KFPr_6wA1y2mlCqqq7U3pL7X9TFMvw99R-9QkBQ7M4P22i3dLFfAIkpswwtyCkDn03djMrt7-L8bOdvispF5KpEanfa5c3CFAt_QljYY1pHR68aY/s320/shot0016.jpg" alt="" id="BLOGGER_PHOTO_ID_5293465613532970322" border="0" /></a><br /><br />And this can't be helped by hintbrushing... because there are too many windows, not enough VIS-blocker wall...<br />So in the next release of Alamo, all this stuff will be clipped if you are too far away.<br /><br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">Important note about the origin brush!</span></span><br /><br />Q3 engine assume for all entities that their bounding box are symetric along all axis!<br />So when you are about positionning the origin brush, move it exactly at the center of your entity, in the middle of both brushes and models that target your <span style="font-style: italic;">func_static</span>.<br />If you don't do that, your entity's bounding box will be extended to get this axial symetry.<br />During the VIS-processing, if any part of the bounding box is visible from a cluster, all your entity will be visible too from this cluster <span style="font-weight: bold;">even if there is no part of the geometry that is actually visible</span>, but just the bounding box.<br /><br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold; font-style: italic; color: rgb(153, 0, 0);">About Cvar that controle far-clipping</span></span><br /><br />You can controle far-clipping in-game with three <span style="font-style: italic;">Cvar</span>:<br /><ul><li>cg_farclip to enable/disable far-clipping (default value is 1, enable), useful if you don't mind far-clipping because you have a powerful computer, or for various reason (if you want to compare what you gain with far-clipping, if you want to record a nice video, etc).</li><li>cg_farclipValue will multiply all distances by this value (default is 1, can't be lesser than 1), if you want that clipping occurs twice farther, set it to 2.</li><li>cg_farclipZoomValue: the same for the sharp rifle zoom mode (default is 3, can't be lesser than 1), it is usefull to have a different value, otherwise you will be able to notice those missing brushes while zooming.<br /></li></ul><br /><br /><br /><span style="color: rgb(255, 204, 51);">That's all for today, see you soon for the advanced far-clipping tutorial!</span>Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com1tag:blogger.com,1999:blog-2415065267446558172.post-72498169151646148622009-01-06T01:29:00.000-08:002009-01-06T07:45:44.700-08:00Using hi-resolution external lightmap<span style="font-style: italic; color: rgb(153, 0, 0); font-weight: bold;font-size:130%;" >Q3 engine and the 128x128 lightmap size limitation</span><br /><br />That's something that have bored me since I started to map... How can I override this stupid limit of lightmap size.<br />When you are still new to mapping, you just don't understand why adding a key <span style="font-style: italic;">_lightmapscale</span> with the value of <span style="font-style: italic;">0.25</span> or <span style="font-style: italic;">0.125</span> to the worldspawn give pretty good result on some part of the map, while being extremely ugly and blurry on some other. Because we all are very naive, we just think <span style="font-style: italic;">"let's reduce this damn value until it looks good"</span>, but it looks never good.<br /><br />Why?<br />It is a little technical...<br /><br />Q3 engine only handle 128x128 lightmap. So even if you specify a smaller value for <span style="font-style: italic;">lightmapscale</span> or <span style="font-style: italic;">samplesize</span>, or whatever, all your mergeable surface will be put by q3map2 in a 128x128 lightmap. This is why tiny brush have a good lightmap precision while large flat terrain have bad. Each tris can't have more than one lightmap, so larger tris can't have too much precision. And that's not all: if you have a flat surface made of multiple tris, all those tris share a single 128x128 lightmap. They are merged. Why? Because if they were not merged, you would not get a seamless lightmapping on this surface, because each tris would have a different lightmap precision, so shadows would be very sharp on small tris, and very blurry on some other, and that's a major problem especially if this is the same shadow that lie on multiple tris.<br /><br />If you doubt about it, you can test it, for example by turning each ground brush you have into its own separated <span style="font-style: italic;">func_group</span>. Face in a <span style="font-style: italic;">func_group</span> will never be merged with face that are not in the same <span style="font-style: italic;">func_group</span> (using this property is a common way to fix light leak). That was my first attempt to get more precision... That was awfull...<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0); font-weight: bold;font-size:130%;" >How to override the 128x128 engine limitation</span><br /><br />I have searched the web forever... I have never seen someone getting it. I have found many forum thread talking about that, some people's answer was: <span style="font-style: italic;">"use the -lightmapsize switch of q3map2"</span>, but they have probably never tested it, cause this switch is for Wolfenstein/ET, if you use it for Q3, you get a full illuminated map, cause the engine just don't load those lightmap.<br /><br />There is only one solution, I found it yesterday, you should use shaders. You should use an external lightmap. Ydnar (the author of q3map2) does that for this purpose! Too bad this feature is just badly documented (as many q3map2's feature). For each surface you want to have a greater lightmap, you have to write this shader:<br /><br /><blockquote><pre>textures/my_dir/my_texture_hi_res_lightmap<br />{<br /> q3map_lightmapSize 1024 1024<br /> q3map_lightmapBrightness 2.0<br /> {<br /> tcgen lightmap<br /> map $lightmap<br /> rgbGen identity<br /> }<br /> {<br /> map textures/my_dir/my_texture.jpg<br /> blendFunc filter<br /> }<br />}<br /></pre></blockquote><br /><span style="font-style: italic;">"<span style="font-weight: bold;">q3map_lightmapSize 1024 1024</span>"</span> instruct the compiler to put the result of the lightmap for all face using this shaders into one or more external TGA image file (standard lightmap are directly stored into the BSP) with a 1024x1024 size, that will be written in your <span style="font-style: italic;">/map/name_of_your_map</span> directory, with a name like lm_0000.tga, lm_0001.tga, and so on. Note that you can eventually modify them with your favorite image editor if something look bad.<br /><br />Alamo's external hi-res 1024x1024 lightmap:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifdYVp2R96eyPubbOoihZ0RC-ja39ElN2U9H0I8iL2MUOIvBjn87osLx4p6w8rfcSw_2vkVgQZOXTdMNGJUvGeYeIzKmVK06HkhVsaL47W2t_2mJ2iqNZdnP-TyMNXqNayaANxGvhw4S4/s1600-h/lm_0000.jpg"><img style="cursor: pointer; width: 320px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifdYVp2R96eyPubbOoihZ0RC-ja39ElN2U9H0I8iL2MUOIvBjn87osLx4p6w8rfcSw_2vkVgQZOXTdMNGJUvGeYeIzKmVK06HkhVsaL47W2t_2mJ2iqNZdnP-TyMNXqNayaANxGvhw4S4/s320/lm_0000.jpg" alt="" id="BLOGGER_PHOTO_ID_5288152773836513890" border="0" /></a><br /><br />Then q3map2 auto-generate a shader file in the <span style="font-style: italic;">/script</span> directory named q3map2_name_of_your_map_lightmap.shader. Here is what you found in this file:<br /><br /><blockquote><pre>// Custom shader file for my_map.bsp<br />// Generated by Q3Map2 (ydnar)<br />// Do not edit! This file is overwritten on recompiles.<br /><br />my_map/7132892A3E304A3B1AEC29CEB002847F<br />{<br /> q3map_lightmapSize 1024 1024<br /> q3map_lightmapBrightness 2.0<br /> {<br /> tcgen lightmap<br /> map maps/my_map/lm_0000.tga<br /> rgbGen identity<br /> }<br /> {<br /> map textures/my_dir/my_texture.jpg<br /> blendFunc filter<br /> }<br />}<br /></pre></blockquote><br />That's the trick! Your external lightmap is just meant as a standard texture! Be carefull, cause q3map2 is forced to create one shader for every lightmap/texture combination. That's why it is best to use a huge <span style="font-style: italic;">lightmapsize</span>, you have good chance that one texture will be combined with only one lightmap.<br /><br /><span style="font-style: italic; font-weight: bold;">q3map_lightmapBrightness 2.0</span> instruct the compiler to render the surface twice as bright. You should have this to work cause standard lightmap use overbright bits, without this line, your surfaces will look darker than usual. With a value of <span style="font-style: italic;">2.0</span>, they will look exactly as bright as it used to be.<br /><br />In the stage part of the shader (remember that stage are for the renderer, while q3map_* are directive for the compiler), there is an important line: <span style="font-style: italic; font-weight: bold;">tcgen lightmap</span>. That's the trick I missed for days... In all usual shader (using true built-in lightmap), this line is implicit. But here we use a conventionnal texture that play the role of a lightmap, so the renderer should be aware that we want to use the lightmap coordinate calculated by q3map2 for this surface.<br /><br />The end of those two shaders have nothing particular.<br /><br />Note that if you want to use this trick for your terrain (modeled or indexed), you should add the directive <span style="font-style: italic;">q3map_lightmapMergable</span>, because you want to merge all tris of your terrain into one continuous and seamless lightmap. I think you need (not tested) <span style="font-style: italic;">q3map_nonplanar</span> and <span style="font-style: italic;">q3map_shadeangle N</span>, and I suggest to tune the value of a <span style="font-style: italic;">q3map_lightmapSampleOffset N</span>.<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0); font-weight: bold;font-size:130%;" >The result</span><br /><br />I have just finished to patch Alamo, all the ground is merged into an external 1024x1024 lightmap. Look at those before/after screenshots!<br /><br /><br />Before, those wagon have no shadow and look just like if they were floating over the ground, after, they cast a nice shadow (even the thin wheels cast shadow).<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihL-mXkDJqaOOe6xvpayohpZScRBBR7QmLJcPhuS0tumbQ46TMdliSTAF2zNbWz-Uiqk4iHNO1sTBsKXmflBzryJeN8fSY7J-_pwYqaxJqAoQ3r-gfz8rnienUlOXpgvswAT6we_fLAmw/s1600-h/shot0005.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihL-mXkDJqaOOe6xvpayohpZScRBBR7QmLJcPhuS0tumbQ46TMdliSTAF2zNbWz-Uiqk4iHNO1sTBsKXmflBzryJeN8fSY7J-_pwYqaxJqAoQ3r-gfz8rnienUlOXpgvswAT6we_fLAmw/s320/shot0005.jpg" alt="" id="BLOGGER_PHOTO_ID_5288140553821172258" border="0" /></a> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtt715sU1Ruceq3NNd62KJsejcYIvwTwP1oKEwt1hDybJvXArxf6tWBk7mfxTaBwI-tf1pwKG8GZNKj5mIci1_KgI976PdyB9NuAUx8TOs2yrB09yHyYhtgouq6AeMqFTMjjQLMxqfwoc/s1600-h/shot0002.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtt715sU1Ruceq3NNd62KJsejcYIvwTwP1oKEwt1hDybJvXArxf6tWBk7mfxTaBwI-tf1pwKG8GZNKj5mIci1_KgI976PdyB9NuAUx8TOs2yrB09yHyYhtgouq6AeMqFTMjjQLMxqfwoc/s320/shot0002.jpg" alt="" id="BLOGGER_PHOTO_ID_5288140547926302386" border="0" /></a><br /><br /><br />Before, those palm tree were able to cast shadow over the wall, but not on the ground. After, they have pretty detailed shadow everywhere.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9hNx-gRpkYVuytKtrPNn2ssBaHFxMCbuuYqUTSmyb5SJ374Ccca6apRNG_-y3fMyCQ-6IT6NL3APGps45_qshw-Atmn5nXx0weBth5uSAGg_-6xRDIsshGYe1iMNTmekht-b_GD1F_mU/s1600-h/shot0004.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9hNx-gRpkYVuytKtrPNn2ssBaHFxMCbuuYqUTSmyb5SJ374Ccca6apRNG_-y3fMyCQ-6IT6NL3APGps45_qshw-Atmn5nXx0weBth5uSAGg_-6xRDIsshGYe1iMNTmekht-b_GD1F_mU/s320/shot0004.jpg" alt="" id="BLOGGER_PHOTO_ID_5288140543572435730" border="0" /></a> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiABD87WH-lsF2N2BsT-PBSg5-Op-ov-fRj4hajAEaeJAVokV5UbI1nSGQkzAU2dGN3bNLfaA3uJ4680ZktqGHZsDTcxmee7ogTHhYQ8bpzYcF16lfCFhXLgv9Ubj1ZvQPwLITD7flwS3o/s1600-h/shot0001.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiABD87WH-lsF2N2BsT-PBSg5-Op-ov-fRj4hajAEaeJAVokV5UbI1nSGQkzAU2dGN3bNLfaA3uJ4680ZktqGHZsDTcxmee7ogTHhYQ8bpzYcF16lfCFhXLgv9Ubj1ZvQPwLITD7flwS3o/s320/shot0001.jpg" alt="" id="BLOGGER_PHOTO_ID_5288140543342890770" border="0" /></a><br /><br /><br />Before, like the wagon, all the scene looks like it floats over the ground, under an omni-directional light... After, it's just more realistic. Note that the arch cast shadow in the second screenshot.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD9IKoF_ew8z1jz3OjDdmKVqzNZgU4woYCABIuOS0J0H5VDacQR8uP3ZvpOiqal1I0vCAYMJF42IlwKko2lkCAPm4V0zTwvGeKwE2lFYG_qz5gZTPAxSFwEkf50ZbpM-BBKfbmhETfii8/s1600-h/shot0003.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD9IKoF_ew8z1jz3OjDdmKVqzNZgU4woYCABIuOS0J0H5VDacQR8uP3ZvpOiqal1I0vCAYMJF42IlwKko2lkCAPm4V0zTwvGeKwE2lFYG_qz5gZTPAxSFwEkf50ZbpM-BBKfbmhETfii8/s320/shot0003.jpg" alt="" id="BLOGGER_PHOTO_ID_5288140240730481314" border="0" /></a> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiPWdCI0njQQiZ9duKsCeDmSTRUceXwsCoGz0R_8Nqn-y_iHO1bgjBaGhsUZ3SFDkHx4sywqQgGBndrp8wRCc8hNDA1Wpcyw48IQQC9DEWJ5BdWqLg-lrxAsEikHnPX1NIjG6RC0yd0lw/s1600-h/shot0000.jpg"><img style="cursor: pointer; width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiPWdCI0njQQiZ9duKsCeDmSTRUceXwsCoGz0R_8Nqn-y_iHO1bgjBaGhsUZ3SFDkHx4sywqQgGBndrp8wRCc8hNDA1Wpcyw48IQQC9DEWJ5BdWqLg-lrxAsEikHnPX1NIjG6RC0yd0lw/s320/shot0000.jpg" alt="" id="BLOGGER_PHOTO_ID_5288140233479808178" border="0" /></a><br /><br /><br /><span style="font-weight: bold; color: rgb(255, 255, 102);">External lightmap are good! Use them!</span>Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com12tag:blogger.com,1999:blog-2415065267446558172.post-15924138759347328442009-01-01T15:00:00.002-08:002012-03-10T15:05:46.147-08:00About me, and about the gameSmokin' Guns is intended to be a semi-realistic simulation of the <span style="font-style: italic;">Old West's</span> great atmosphere & was developed on Id Software's Quake III Arena Engine. Here is the official website of the game:<br /><a href="http://www.smokin-guns.org">http://www.smokin-guns.org</a><br /><br />I'm known as <span style="font-style: italic;">Joe Kari</span> on this forum, and on game server.<br />I'm french, that's why I speak english so bad ;)<br /><br />I contribute to the game with a map named <span style="font-style: italic;">Alamo</span> and with various other stuff like md3 models, textures (but in fact that's my brother that made 90% of them), shaders, and some piece of game-code too.<br /><br />I will try to post some tricks and explanation that cover: mapping (with GtkRadiant), texturing (with Photoshop), md3 modeling (with Misfit Model 3D, developpement version), and shaders engineering (with... er... notepad lol). Few things are really undocumented, so I propose to share with you the results of hours of headach.Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com0tag:blogger.com,1999:blog-2415065267446558172.post-37188004402556049012009-01-01T14:00:00.000-08:002009-01-01T17:51:56.577-08:00Using models<span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >An introduction to misc models</span><br /><br />Misc models, also known as <span style="font-style: italic;">mapobject</span> are models external to your MAP file. You can add a misc model by right-clicking on one of your 2D view in Radiant, and by choosing in the contextual menu: misc>misc_model. You can use two kind of models: ASE and MD3.<br /><br />Note that misc models are compiled by q3map2 into a your BSP file. They are external only at editing stage (there are <span style="font-weight: bold;">not</span> in the MAP file), but then they are fully incorporated in the BSP file. This mean that you don't have to include your ASE models and MD3 models in your pk3 when you release your level.<br /><br />Also, the first time you will use MD3 models as mapobject, you will confuse a bit, cause MD3 are ordinary used for dynamic models too. So let's clear something right now: <span style="font-weight: bold;">misc models can't be animated</span>, even if you use an MD3 that has animation frame (in this case the first frame will be used, and the others will be ignored). And <span style="font-weight: bold;">if you update an MD3, you will not see any change on your level, as long as you don't recompile your MAP file</span> (and remember that you don't need them to be present at runtime). However, while dynamic models receive light from the <span style="font-style: italic;">lightgrid</span>, misc models use <span style="font-style: italic;">vertex-lighting</span> (you can make <span style="font-style: italic;">lightmap'ed</span> models too, we will see that on another blog post).<br /><br /><br /><br /><span style="color: rgb(153, 0, 0); font-style: italic;font-size:130%;" >Brushwork </span><span style="color: rgb(153, 0, 0); font-style: italic;font-size:130%;" >VS misc models</span><br /><br />Brushwork is the base of mapping. A brush is a volume, limited by clipping plane. So a brush is a convex form (i.e. without cavity). This property ensure that for every clipping plane, the entire volume is on the same side, and that the other side is <span style="font-style: italic;">outside</span>. So brush are very interesting for game, because of physics: you know if you are in a brush (or collide with it) if you are <span style="font-style: italic;">inside</span> for all the clipping plane of the brush. Faceq of a brush are just the result of intersecting plane, leaving out parts of the plane that are <span style="font-style: italic;">outside</span>. So faces are not limited to 3-sided polygone (<span style="font-style: italic;">tris</span>), but can be 4-sided (<span style="font-style: italic;">quad</span>), or even n-sided polygone. Of course q3map2 transform them into <span style="font-style: italic;">tris</span>, for the renderer, but keep the brush structure for the physical engine.<br /><br />A model is simply a collection of 3-sided faces. Physical engine doesn't care of them, they are unexistant for it. If you want to make them solid, you have to make a brush inside of it, with the <span style="font-style: italic;">player clip</span> texture (block players) or the <span style="font-style: italic;">weapon clip</span> texture (block weapons and players), the renderer just ignore those textures, only the physical engine care of it. There are some others ways to clip a model without adding clipping brush, using <span style="font-style: italic;">autoclipping</span>, we will see that on another blog post. And of course, models are not structural, and not VIS-blocker.<br /><br />Brushwork is good for:<br /><ul><li>physical clipping</li><li>big structural stuff, like wall, house, corridor, ground, and so on... anything big and simple is best using brushwork<br /></li><li>curves!!! (yes, curves are not brush, but they are directly inside the MAP format and are created with Radiant) they can sometime replace a model<br /></li></ul>Brushwork is bad for:<br /><ul><li>texture coordinate are just weird axial projection, and Radiant's texturing interface just suck<br /></li><li>arbitrary rotation just break the whole thing, if you have made something fine, you just can't re-use it at another angle except 90°, 180° and 270° degrees... (by the way q3map2 can turn your brushwork into an ASE model, if you invoke it with the right option)</li><li>you can't rescale a brushwork<br /></li><li>generated <span style="font-style: italic;">tris</span> used by the renderer are weird too, and the <span style="font-style: italic;">T-Junction fix pass</span> of q3map2 generate even more poly, <span style="font-weight: bold;">except if you have great mapping skills and a lot of patience</span> (but most of time, optimizing for the renderer make things more difficult for the physical engine)</li><li>sometime doing complex stuff with brushwork, like a chariot's wheel, needs too much brush, so the physical engine will have too many test to perform, and it will hit performance when people try to interact with that (jumping on, shooting at, ...)<br /></li></ul>Models are good for:<br /><ul><li>small objects, object that need great precision</li><li>object with complex geometry<br /></li><li>advanced texturing (only if you are using MD3)</li><li>things that are present on your level at various and non-axial angles, and at various scale<br /></li><li>freedom!!! you can do everything with models, whithout dealing with brush (and Radiant) limitation/annoyance (again, only if you are using MD3)</li><li>optimizing polycount, because you have full control over it (MD3 only)<br /></li></ul>Models are bad for:<br /><ul><li><span style="font-style: italic;">func</span> entities... most of <span style="font-style: italic;">func</span> entities (like <span style="font-style: italic;">func_train</span>, <span style="font-style: italic;">func_pendulum</span>, ...) accept a key named <span style="font-style: italic;">model2</span> but doesn't give great flexibility there (for example, you can't group many models into the same entity)<br /></li><li>physical engine... autoclip'ed models have to create brush for the game's physics, so it creates <span style="font-weight: bold;">one brush per tris</span>!!! For example, a simple autoclip'ed cube-box model will generate 12 brush, while only one is needed if you do it by yourself. Of course this is the worst case, most of time you will get 3 or 4 times more (in some special case you can even have less brush generated, if you are not using the <span style="font-style: italic;">autoclip spawnflag</span> but a special <span style="font-style: italic;">autoclip shader</span> that cover roughly your geometry)... <span style="font-weight: bold;">Never use the </span><span style="font-style: italic; font-weight: bold;">autoclip spawnflags</span> <span style="font-weight: bold;">on small or high polycount object</span>...<br /></li><li>big structure... since they can't be structural nor VIS-blocker, if you want to use them for big structure you have to seal the area with caulk... you can use them anyway, for terrain for example, but do it only if you can't make it with brushwork or an indexed terrain</li><li>light: models are basicly using vertex-lighting that isn't very good-looking (except for small and/or high polycount object)... you can turn them into lightmap'ed models, sometime it does it well, sometime not too much<br /></li></ul><br /><br /><br /><span style="color: rgb(153, 0, 0); font-style: italic;font-size:130%;" >MD3 models VS ASE models</span><br /><br />You will soon realize that I'm a big fan of MD3, and almost never use ASE models. First because ASE are made with Radiant, so you lose most of advantage using models. And to be honest, I'm not fond of Radiant, too much bug, not very user-friendly, and lot of stuff are definitively bad (like editing texture coordinate or moving vertex).<br /><br />ASE models:<br /><ul><li>are made using Radiant, then compiled with q3map2 with special option (first with <span class="postbody"><span style="font-style: italic;">bsp -meta -patchmeta -subdivisions 6</span></span> then with <span class="postbody"><span style="font-style: italic;"> bsp -convert</span></span> [your_bsp])</li><li>are usefull if you have done some brushwork, then realize that you need to duplicate it with a random angle and a random scale<br /></li></ul>MD3 models:<br /><ul><li>are made using a 3D modeling software (couldn't be done with Radiant), many software support it<br /></li><li>you don't have to lose your nerve because of Radiant bugs/limitations/weirdness<br /></li><li>can use true UV texturing instead of weird axial projection</li><li>great control over the geometry<br /></li></ul><br />A little limitation with MD3: you can't make it to big. Not a big deal, you have to scale down your md3, and scale it up in Radiant (entity special key: <span style="font-style: italic;">modelscale</span>).<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >Spawnflags of a model entity</span><br /><br />In radiant, select your model and enter the entity menu ('n').<br />If you want your model to be lightmapped (most of time it give you a better lighting effect), create a new key named <span style="font-style: italic;">spawnflags</span> and give it the value of <span style="font-weight: bold;">4</span>.<br />If you want your model to be autoclipped (I should warn you again that this is generally a bad idea), assign the value of <span style="font-weight: bold;">2</span> to this key.<br />Because this key works as bit-flags, if you want your model to be lightmapped <span style="font-weight: bold;">and</span> autoclipped, assign to <span style="font-style: italic;">spawnflags</span> the value of <span style="font-weight: bold;">6</span> (4+2).<br /><br /><br /><br />Next time I will explain how to use an <span style="font-style: italic;">autoclip shader</span> to fine clip a model without hurting performance.Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com2tag:blogger.com,1999:blog-2415065267446558172.post-36277139068718332022008-12-26T10:52:00.000-08:002009-01-01T18:10:36.493-08:00Power-of-2-sized textures<span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >What is power-of-2-sized texture?</span><br /><br />Power of 2 are number of type 2^n, where 'n' is an integer number. You can find power of 2 numbers simply by multiplying the previous power of 2 number by 2.<br />Here is a little list of power of 2 numbers :<br />1 2 4 8 16 32 64 128 256 512 1024 2048... and so on...<br /><br />A power-of-2-sized texture is a texture that both width and height are power of 2 number.<br />For example, 128x128 is a power-of-2-sized texture. 512x128 is a power-of-2-sized texture.<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >Why power-of-2-sized textures are better than non-power of 2 one?</span><br /><br />Because OpenGL (and video cards) only handle power-of-2-sized textures (for performance issues). Quake3 engine and other games interpolate non-power-of-2 at runtime (when the game loads the level), and transforms them into the closest smaller valid power-of-2-sized textures. But it only supports it roughly, and there are three issue: first there is no reason to waste hard drive space and bandwidth for something that will always be used at a reduced size, second it slows down the loading of your level, and third (the worst) Q3 engine does not resize image with the same quality than Photoshop or The Gimp does, and create ugly blurry texture. Yes you read it! Sometime less is more...<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >Now the proof!</span><br /><br />Let's take a look at what happens in-game with those 4 textures (modified from my map "The Alamo"):<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4TuT_3QR05uOkwJoT0ez59jTKaSEBJmkZcpMSROb8A8uktokUThqja1lZqFwYcdgCS7XuUxeOPk7Qnn_oXIkST8Hg5pJsR-Z8gCg170dIc4o_kg0-G-t99aSvjdfGolfrM9pRMpiDoJs/s1600-h/256x512.jpg"><img style="width: 100px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4TuT_3QR05uOkwJoT0ez59jTKaSEBJmkZcpMSROb8A8uktokUThqja1lZqFwYcdgCS7XuUxeOPk7Qnn_oXIkST8Hg5pJsR-Z8gCg170dIc4o_kg0-G-t99aSvjdfGolfrM9pRMpiDoJs/s400/256x512.jpg" alt="" id="BLOGGER_PHOTO_ID_5282593498317321538" border="0" /></a> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyWFQEgbA04OeiOtMa1W7YfQ8iJgkZxJm-hMx1SSjiOi7XjebP31f688cNeWn0Kik1AitmVPvpSjBAECziTuz2xS2Lf7kqI5aeF4oWWKRTwk_vgBh8STIl9uTD7zZqV_ijiVXBAvl9c8k/s1600-h/250x500.jpg"><img style="width: 100px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyWFQEgbA04OeiOtMa1W7YfQ8iJgkZxJm-hMx1SSjiOi7XjebP31f688cNeWn0Kik1AitmVPvpSjBAECziTuz2xS2Lf7kqI5aeF4oWWKRTwk_vgBh8STIl9uTD7zZqV_ijiVXBAvl9c8k/s400/250x500.jpg" alt="" id="BLOGGER_PHOTO_ID_5282593495534445234" border="0" /></a> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ksuRkJVMfih6N7ubKMfL_BGh98X_o4YKXDFvp_Kfanu0QwDKVmr78YxZp4maPfhZB2qJydwgyNYedNt0ee0Mc5C5bbCJXG8QgZYFwM1Tb6TDrR-7iMLVD8c2Qp18Xabj62l0-r7-O9M/s1600-h/130x260.jpg"><img style="width: 100px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ksuRkJVMfih6N7ubKMfL_BGh98X_o4YKXDFvp_Kfanu0QwDKVmr78YxZp4maPfhZB2qJydwgyNYedNt0ee0Mc5C5bbCJXG8QgZYFwM1Tb6TDrR-7iMLVD8c2Qp18Xabj62l0-r7-O9M/s400/130x260.jpg" alt="" id="BLOGGER_PHOTO_ID_5282593489657909474" border="0" /></a> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-6VvSWnqD_TyxpCE8sAU5F9gjgtktokBT5iVtPVeyN_e9ekGSIHAmcNqz989C2q4XSU23SBsfCi47dIoFS3wGLudBmAx3jBpvkTop_iO__t-u6qycpPrGX_TMBWSkUgxNvb7qE1ZMPbY/s1600-h/128x256.jpg"><img style="width: 100px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-6VvSWnqD_TyxpCE8sAU5F9gjgtktokBT5iVtPVeyN_e9ekGSIHAmcNqz989C2q4XSU23SBsfCi47dIoFS3wGLudBmAx3jBpvkTop_iO__t-u6qycpPrGX_TMBWSkUgxNvb7qE1ZMPbY/s400/128x256.jpg" alt="" id="BLOGGER_PHOTO_ID_5282593482470330290" border="0" /></a><br /><br />From left to right : 256x512 (power-of-2-sized), 250x500, 130x260, and 256x512 (power-of-2-sized). Click image to see them full-sized.<br /><br />And here is what you get in-game:<br />Left : 128x256, right 130x260. Click image to see more detail.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh6-o6IacJhFH4YyNTQoY3yxkb4nA2IKZ_21tiAeMQhqm23rg3hQQDnyd1-AIzOmikN9g2GxwpoegZrz5S9JsGu0MSRHa3Y4uljFVrUojTiyb2Nxisb_aysUNS4wYcTXPpd-MBKN8WQNY/s1600-h/ingame128x256and130x260.jpg"><img style="width: 320px; height: 241px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh6-o6IacJhFH4YyNTQoY3yxkb4nA2IKZ_21tiAeMQhqm23rg3hQQDnyd1-AIzOmikN9g2GxwpoegZrz5S9JsGu0MSRHa3Y4uljFVrUojTiyb2Nxisb_aysUNS4wYcTXPpd-MBKN8WQNY/s320/ingame128x256and130x260.jpg" alt="" id="BLOGGER_PHOTO_ID_5282601241097502978" border="0" /></a><br />As you can see, the right texture is blurry, and especially if you look at the border.<br /><br />Left : 250x500, right 256x512. Click image to see more detail.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKfZ8BhBAkiLSBRvkxZlMfJAFEuwkxX8iM-1wLVxZq5I25Y3jauUIj7dV9mBh4K-e2aWc2dKu5DGOv_eQsrQIgLtmb0lhBVpA4mVsHxkAH7Nzh29ug_iwCbOW8gDxJNyfki6pBLh2EBv0/s1600-h/ingame250x500and256x512.jpg"><img style="width: 320px; height: 241px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKfZ8BhBAkiLSBRvkxZlMfJAFEuwkxX8iM-1wLVxZq5I25Y3jauUIj7dV9mBh4K-e2aWc2dKu5DGOv_eQsrQIgLtmb0lhBVpA4mVsHxkAH7Nzh29ug_iwCbOW8gDxJNyfki6pBLh2EBv0/s320/ingame250x500and256x512.jpg" alt="" id="BLOGGER_PHOTO_ID_5282601245415500786" border="0" /></a><br />This time it is more impressive ! You can see that only a few pixels can entirely change the feeling of the texture. Left we have a blurry texture, while the one on the right has sharper detail.<br /><br />If you look at the first and the second in-game screenshots, you will see that even the 128x256 texture looks better than the 250x500 textures... And that's logical, cause the engine has resized (badly) the 250x500 textures to a 128x256 one, which is the closest power-of-2 size that is smaller than the original one.<br />And the filesize of the 128x256 textures is 19Ko, when the filsize of the 250x500 texture is 66Ko. Three time the size for something less desirable...<br />What a waste of quality and of hard-drive space ? (and bandwidth for server with auto-download enabled)<br /><br />That's why it's bad to use non-power-of-2 sized texture.<br /><br /><br /><span class="postbody">So how to efficiently save your work? That's the next tutorial!</span>Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com0tag:blogger.com,1999:blog-2415065267446558172.post-49752795800686536282008-12-24T10:57:00.000-08:002009-01-01T18:14:01.465-08:00How to save your texture?<span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >Exporting a texture</span><br /><br />It's always a good idea to work on supersized image, but when the time come to export it as a texture, you have to choose the right size and the right format.<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >Resizing your image</span><br /><br />Choosing the right size of your texture is one of the more important thing in texturing.<br /><br />If you resize it too small, the texture will look blurry in-game at close range, and even at mid and long range if you shrink it too much. This will look bad, and not realistic.<br /><br />If you resize it too big, then the texture will look fine everywhere, but it will use too much VRAM (video memory). In case your video card doesn't have enough memory, the texture will be stored in your RAM, hurting your game framerate badly (all textures that are outside the VRAM will be copied through the AGP/PCI port <span style="font-weight: bold;">for every screen refresh</span>). However, if your texture can't be seen at close-range, you will never have benefit of such a size, cause only mipmap of your texture will be used. A mipmap is a 2 time smaller texture, used everytime the texture displayed size (in texel) is far too smaller than the original size (in pixel), for performance issue (of course this depends on your actual screen size).<br />There is no need to have a texture that is always zoomed out in-game compared to its real size, for example, if you run the game at 1280x1024, and you have a 512x512 texture that never take one quarter of your screen, your texture (cycle) will take at best 256x256 pixel of your screen. So it is wise to reduce it to a 256x256 one.<br /><br />When you have made up your mind, go to your favorite software, resize it and export it.<br />If you are using Photoshop or The GIMP, always use the <span style="font-weight: bold;">bicubic</span> algorithm! Last edition of Photoshop have the <span style="font-style: italic;">bicubic sharpen</span> algorithm that do it very well.<br /><br />Remember that your texture <span style="font-weight: bold;">must be</span> a power-of-2-sized one (look at <a href="http://sgq3-mapping.blogspot.com/2008/12/power-of-2-sized-textures.html">this post</a> for the why).<br /><br /><span style="color: rgb(51, 102, 255);">Note : Don't worry if resizing a texture to a power-of-2 one wastes the height/width ratio: you just have to set a different X and Y scale for that texture in Radiant ! As you can see in my previous blog post, my painting texture look thin, but in-game, it has a good ratio.</span><br /><br />Now you have to choose the right file format.<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >The TGA format</span><br /><br />You should use the TGA format only if you need alpha channels for that texture.<br /><br />TGA is a non-destructive file format. You will have max quality using this, but in fact, JPEG (at 80% quality) looks the same, but takes 10 times less space most of time.<br />If you have semi-transparent textures or see-through textures, you must use TGA because of the alpha-channel requirements (too bad PNG-24 isn't handled by Q3).<br />If you are using Photoshop, save it as 32bits, enable <span style="font-style: italic;">alpha channel</span>, and enable <span style="font-style: italic;">RLE compression</span> (a rough non-destructive compression).<br /><br /><br /><br /><span style="font-style: italic; color: rgb(153, 0, 0);font-size:130%;" >The JPEG format</span><br /><br />If you are running Photoshop, don't save with <span style="font-style: italic;">Save As</span>, use <span style="font-style: italic;">Save for Web</span> instead, because filesizes are more optimized (especially for small files).<br />Disable the <span style="font-style: italic;">progressive</span> checkbox, Q3 doesn't know how to handle progressive jpeg (this feature is only useful for web-browsers, allowing pictures to be displayed with multiple passes, with less blur at each pass).<br />Enable the <span style="font-style: italic;">optimize</span> checkbox (reduces filesize).<br />Use a quality of 80%. <span style="font-weight: bold;">Never drop quality under 80%</span> because of the famous <span style="font-weight: bold;">JPEG artifact</span>! Nobody wants crappy textures! It's useless to use a quality over 80%, you wont see any change, but fileweight will increase drasticly.Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com1tag:blogger.com,1999:blog-2415065267446558172.post-57513256135775547332008-12-24T09:40:00.000-08:002009-01-01T18:04:00.056-08:00How to refresh an old textureIn my map <span style="font-style: italic;">Alamo</span>, I wanted an old western wallpaper, so I have looked at the standard Smokin' Guns textures set and picked this one:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ7LQti7EdISfNP-1zc-SI34vvttY6lM7kK7vQiRQ90UC5hPAiywqHtUcUl6ofxZdYC4uFmjd5_PEykh6s8WdqAhiRcifwjmrea0GboTg48OvNIfaW-1pkRheFV7fqWpPDxAmoYcNW_1k/s1600-h/clothwallpaperorigce3.jpg"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ7LQti7EdISfNP-1zc-SI34vvttY6lM7kK7vQiRQ90UC5hPAiywqHtUcUl6ofxZdYC4uFmjd5_PEykh6s8WdqAhiRcifwjmrea0GboTg48OvNIfaW-1pkRheFV7fqWpPDxAmoYcNW_1k/s200/clothwallpaperorigce3.jpg" alt="" id="BLOGGER_PHOTO_ID_5283336135201353522" border="0" /></a><br />(click it to see it full sized)<br /><br /><span class="postbody"> Run the game, get close and look at the wall... Damn... has a lot of noise and artifacts... Even at mid-range...<br />Because it's very difficult to find western wallpaper pictures over internet (never found one), I have decided to remake this one.<br /><br />Because it is an old wallpaper, it was very simple. I don't need sharp detail... Just need the original color and contour...<br /><br />First I have resized it to 512x512 (with bicubic algorithm of course!).<br />Then I have applied a <span style="font-style: italic;">gaussian blur</span> of 2 pixels (photoshop : filter>blur>gaussian blur). This removes all JPEG artifacts, but cause a loss of detail... But I don't care: just want the color and basic shape !<br /><br /></span><span class="postbody"> Then I have applied an <span style="font-style: italic;">artistic filter</span>, I don't remember which one, sorry , maybe <span style="font-style: italic;">sponge</span>. Just test many of them (photoshop : filter>artistic>?), until it looks good. Because it is a wallpaper, it was logical that an <span style="font-style: italic;">artistic filter</span> may look good. Now I have a nice texture with a painting feeling.<br /><br />Finally, I have added a <span style="font-style: italic;">canvas effect texture</span> (sorry, I run a french version of photoshop... something like : filter>textures>textures, then choose <span style="font-style: italic;">canvas</span> or something you like).<br /><br />After only five minute, I have made this texture: </span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS-SZVbavc0thb5z5bOS1YXN5P2StfnlzNu8nAwOdlFTzuPZxsh_uFO6eNwlMcIHcoMYHOzGHwSIhueoJp6ZCsU5bkh7ARfDK3KTAk8OcpIvWvmdZmPlY02qll9ZSuHlsIvqUYQwUM9t8/s1600-h/clothwallpaperremixzx9.jpg"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS-SZVbavc0thb5z5bOS1YXN5P2StfnlzNu8nAwOdlFTzuPZxsh_uFO6eNwlMcIHcoMYHOzGHwSIhueoJp6ZCsU5bkh7ARfDK3KTAk8OcpIvWvmdZmPlY02qll9ZSuHlsIvqUYQwUM9t8/s200/clothwallpaperremixzx9.jpg" alt="" id="BLOGGER_PHOTO_ID_5283336401584289314" border="0" /></a><br />(click it to see it full sized)<br /><br /><br />Nice! Isn't it?Mr Applefishhttp://www.blogger.com/profile/16538089889109841072noreply@blogger.com0