Materials

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


Sie betrachten gerade eine ältere Version des Eintrags. Klicken Sie hier, um zur aktuellen Version zu gelangen.

  • There are different possibilities on how to design objects in Train Fever. For that purpose you need to set up materials which control the surface properties. You can read the possibilities here...
    In Train Fever there are different file formats (German) gave answer Their special purposes. Here i want do take a closer look at the material .mtl files. [HL] Structure of a .mtl file [/ hl] At .mtl files basic set-up looks like this: [code] function data () return { params = { fade_out_range = { fadeOutEndDist = 20000, fadeOutStartDist = 10000, }, [...] props = { coeffs = { 1, 1, 0:25, 20, }, }, {= two_sided twoSided = false, }, } , type = "REFLECTIVE_NRML_MAP" } end [/ code] [hl = 2] Structure of material-type declarations [/ hl] Here I cut something in the mid [...] Because this Part shall be the core of this entry : The different possibilities of material types and Their setting. As far as I know, this can be a mix from up to three blocks, each having a structure like that: [code] = { compressionAllowed = true | false, filename = , magFilter = , minFilter = , mipmapAlphaScale = 0, type = , wraps = , wrapt = } [/ code] [hl = 2] parameter for materials [/ hl] I'll hav A Closer Look at the later, for now I want to show the inside of this block: - [b]compressionAllowed[/b] accepts the values [i]true[/i] or [i]false[/i] and deterministic mines, if a texture gets compressed internally (meant is the data in the video RAM of your GPU, not a file compression on your disk like RLE) or not. This compression Could probably lead to a loss in quality but saves video RAM. While using big textures This could be a good option. - [b]filename[/b] wants to be fed with the path to your texture in relation to this folder: ... Train Fever / res / textures. You need to surround it with quotes ("). - [b]magFilter[/b] and [b]minFilter[/b] take care of Mipmapping On the one hand Mipmapping helps against the scintilliation-effect. (somekind of aliasing while rendering textures - Especially When An object is drawn very small while having A big texture attached (lets say a 2x2k texture has to be shrinked to 100x100 pixels, then It could look ugly Vary, Especially When movin around) and on the other hand some performance issues. When objects are very small on the screen you dont need A big texture -.. but When you see it zoomed in, you'll do to Solve this, mipmapping Generates a bunch of texture copies, each a bit smaller then the last one Then it is Able to Provide Small objects with a small version of your texture and zoomed objects are drawn with the big original texture. Imagine it like a "texture LOD". The advantage is, did you save some performance, Because to display 100x100 pixels, you dont have to read the whole texture from 2x2k Your Memory (but lets say a version with 128x128 pixels). The disadvantage is a higher memory consumption. In default OpenGL shrinks each miplevel by the half size (2x2k -> 1x1k ...) and with mipmaps you end up in about one third more memory used. I gave as value here and in OpenGL there are modes for the Following mipmapping: [b][/b][i][/i][i][/i] [b][/b] [b][/b][b][/b] [list][*]GL_NEAREST (simply chooses the color of the nearest pixel [color=#FF0000]*[/color] (nearest neighbor filtering) from the main texture (base mipmap) (at least its deactivated mipmapping)) [*]GL_LINEAR (The Same like nearest NEAREST, only the color value is interpolated between the surrounding pixels [color=#FF0000]*[/color] )[*]GL_NEAREST_MIPMAP_NEAREST (the nearest mipmap (miplevel) is choosen [color=#FF0000]**[/color] and nearest neighbor filtering is Applied)[*]GL_NEAREST_MIPMAP_LINEAR (the values of the nearest miplevels will be interpolated [color=#FF0000]**[/color] and nearest neighbor filtering is Applied)[*]GL_LINEAR_MIPMAP_NEAREST (the nearest mipmap (miplevel) is choosen [color=#FF0000]**[/color] and linear interpolation is Applied)[*]GL_LINEAR_MIPMAP_LINEAR (the values of the nearest miplevels will be interpolated [color=#FF0000]**[/color] and linear interpolation is Applied)[/list][Spoiler] [color=#FF0000]*[/color] OpenGL is using a floating-point area from 0..1 for TextureCoordinates. If we have a texture with a size of 1024x1024 pixels on Which a polygon is mapped, every point (vertice) of this polygon owns a UV position within this texture. Lets say our polygon is mapped into the pixels from 300 to 425 and OpenGL now tries to find a color value somewhere in between this range (Assuming, its a value on 1/3 of our polygon area). With our texture size Given the 300th pixel corresponds to the value x = 300/1024/1 -> x = 300/1024 = ~ 0.29297 of the floating space from 0..1. But we want the pixel one third the way from 300 up to 425! This Means a distance of 125 pixels and 33% Of That points to 41,667 pixels. So we are looking for the color value of pixels 341,667. Expressed as texture coordinate it would be ~ 0.33366. But the problem is here at pixel 341,667. There are only the pixels 341 or 342. NEAREST now chooses the closer pixel, what results in the color value of the 342th pixel. LINEAR would mix the colors of Both pixels in a weighted way. 341 667 Means That We Want to mix one third of pixel 341 and two third of 342. [color=#FF0000]**[/color] This works prinzipell similar to the just described - only that it this is not about the pixels, but the Miplevels. A texture is because of me with every step of the mipmap generation by 1/4 reduced (halved page size). Our base Miplevel is therefore the original texture with its 1024x1024 pixels Miplevel 1 would then only have 512x512 pixels and so on and so forth. With default settings the games is as long as driven until the Miplevel texture only is still 1x1Pixel large. The factor of reduction in size and the maximum number of Miplevels can be in state OpenGL also has no relevance for us as we did not in the can intervene source code. Now we have an object in 200m distance and therefore it is by accident between two Miplevels , At 100m is for example geswitched of baseMip on Miplevel1, at 250m on lvl2 etc etc. When NEAREST variant the "more" mipmap is again. selected (in our example, the lvl2 - 1 is "100m away", 2 50 (figuratively spoken)) with linear, as already explained again interpolated / mixed. [/ spoiler] [hl = 2] End of translation for now [/ hl] As a side note it should be said that you have to enter here without the GL_ Prefix these values , So not GL_LINEAR_MIPMAP_LINEAR but LINEAR_MIPMAP_LINEAR! In addition, part of this figure again in quotation marks (") magFilter (magnification. - Magnification) gives the user-to-use method to when the actual texture must be vegrößert (one is close rangezoomed and the object is for example shown with 500Pixeln, though. Texture for only 400Pixel is great) and minFilter (minification - reduction) just when they should be reduced for the magFilter can. one common example renounce Mipmapping, since in this case anyway , the base-level (the largest = original texture) displays and there is no even bigger MipLevel. - Wraps and wrapt are similar to handle Again accesses OpenGL modes back: GL_REPEAT (texture is repeated). GL_CLAMP (texture will not be repeated) GL_CLAMP_TO_EDGE (texture will not be repeated and, if necessary . with the "last" valid color padded) GL_CLAMP_TO_BORDER (texture will not be repeated and, if necessary, with a defined "border-color" filled) I admit, really I will now not it smart (my OpenGL book is English and That sounds all the same xD), is recommended anyway CLAMP_TO_EDGE. Wraps and T stands for the texture coordinates S and T, a texture coordinate Ensprechung for XY - S would be nothing else like X in "textures Language" and T Y. Even just the information is again without GL_ prefix and must in quotation marks are taken ( "). - type is the type of texture to handicapped persons. would 2D, the value of of this would be "TWOD" -. Two dimensional OpenGL support in principle, 3D textures (fog, for example), if the but is also useful for us, can I do not say I type. In any case the fact that it then "Threed" should read Another. possibility would Cube-Maps for skyboxes Here one would have. Accordingly, "CUBE" specify. - mipmapAlphaScale looking meanwhile for a Erklärbär - in good German: Here I now really have no idea. You see already, the best I've finally lifted. [hl = 2] Possible materials types [/ hl] now but back to the 's. There are various ways . and combinations for you this will not be in quotation marks (") set, I will hereafter only once every call and summarize their effects together: - map_color_reflectRGB channels: color / texture alpha channel: degree of reflection - map_color_alphaRGB channels: color / texture alpha channel transparency - map_normalRGB channels: Vector use, unit vectors for determining the deviation of the surface normal alpha channel: Specular gradient - map_envUmgebungs texture, alpha channel seems superfluous [hl = 2] comments [ / hl] map_color_reflect allows you to display reflective surfaces. This applies to note: The more transparent, the specular. As field of application could be mentioned here window. Anyone (like me ^^) also does not just want to model inside of a vehicle / house can with this method to achieve good results. map_color_alpha allows it you represent transparent areas. The degree of transparency is of course to the "transparency" (just transparency). Should extent be logical. Areas of application would be here because of me any steel towers. Instead of a complex mesh bludgeons you a simple corresponding steel struts texture through a simple 4-Eck mesh. Fences are therefore quite feasible. Or even for as crazy as me: actually glass map_env is an environment texture to (environment). It will therefore usually / usefully declared cubemap. Here you can therefore possibly also enclose a separate environment map, otherwise it uses the simple TF: "c.tga". map_normal you allow the use of normal maps. The alpha channel is responsible for specularity - let 's say the shine factor. Wood, for example, looks rather dull, so here no transparency would be useful. Chrome / steel ... however, shines quite well in the sun - transparency would be quite an option. If you have any questions about normal maps per se, it writes - for first I let a detailed statement to the outside. If you are interested please complete but I liked it. Further, it should be clear that an environment texture makes sense only if one reflecting surfaces / materials used. But normal maps with specularity should both reflect ..._ act as with ..._ alpha. [HL] The type parameter [/ hl] Almost at the end of our .mtl file still is a type parameter. This you must adjust depending on the features used: type = "REFLECTIVE" (map_color_reflect used her whether this necessarily a map_env entry is required is beyond my knowledge, it is. possible that an absence is filled with the default texture) type = "REFLECTIVE_NRML_MAP "(you use map_color_reflect plus map_normal, map_env as just) type = "transparent", (you used map_color_alpha) type = "TRANSPARENT_NRML_MAP" (you use map_color_alpha plus map_normal - even so far not used, is rather advised that it is the are) [color=#FF0000][/color]

Teilen