29

A material is a combination of attributes which describe how a surface of the given material should look like. Some engines use different shaders for different materials, in which case a material definition could look like this: [Material] Shader=NormalMappedSpecular.glsl Texture1=Rock.png Texture2=RockNormal.png Texture3=RockSpecular.png Other engines ...


10

I'll try to answer to the best of my knowledge, with little knowledge about the specific case of UE4, but rather on the general technique. Graph based materials are as much programming as writing the code yourself. It just doesn't feel like it for people with no background on code, making it seemingly easier. So, when a designer links a "Add" node, he is ...


10

A material specifies how an object responds to light. There are a couple of common parameters: Kd: Diffuse response to light Ks: Specular response to light Ns: "Shininess" map_Kd: Texture Now say you have a triangle rendered with material M. M has Kd=(1,0,0) (red diffuse response), Ks=(1,1,1) (white specular response), Ns=25 (specular highlight will ...


10

Due to the sheer volume of data in your average voxel world, it will be challenging to draw much geometry with your approach, before hardware limits are reached, without some kind of spatial subdivision approach. You also need to be highly efficient in packing data at the bit/byte level. Method: RLE Enter Run-Length Encoding (RLE) compression as a popular ...


10

since you admittedly don't have much experience with 3D and (presumably) OpenGL, I'll give you a "bird's eye" overview of the process. I'll do my considerations about OpenGL, but the basic reasoning yields for other APIs too. When you render something with a modern version of OpenGL you create objects that will reside into the GPU memory, and then mostly ...


9

Well, Shading languages like GLSL and HLSL is what all the "material" code ultimately get translated to in the end. Shaders are the actual programs which are run directly on the GPU, and to create them, you use a shading language. 3D packages are generally used to make it easer for you to make realistic looking graphics, and writing shaders by hand is a ...


6

Great question! There are a few online repositories of measured optical data about various materials. BRDFs: http://www.merl.com/brdf/ http://www.cs.columbia.edu/CAVE/software/curet/ These are tabulated according to incoming and outgoing light direction, so if you want to approximate them as diffuse and specular, you'll have to fit those curves to the ...


6

It's a good idea to separate parameters into a few categories based on how often they're changed, or which other parts of the renderer they hook up to. For instance: Frame parameters - like the camera matrix, screen size, and current time Material parameters - like textures, specular and gloss values, etc. Object parameters - like an object's world matrix, ...


6

MaterialPropertyBlock probably what you are looking for. Just make sure to create the block once and cache it, to save on garbage collection. I'd create one MaterialPropertyBlock per piece color (so a red and a black, with the material by itself being white), cache them, and apply the block to each piece as needed.


5

Physically based rendering basically means that you strive to have realistic materials and lighting calculations. The way you do this can vary a bit (or a lot) depending on application, but the main idea is that no material can reflect more light back than hits it, and preferably you want to measure the Bidirectional reflectance distribution function (or ...


5

I'd recommend testing empirically to confirm, but the second answer at this link says that triangle data for submeshes is indexed sequentially in order of submesh index. That means all the triangles for submesh 0 have lower indices than those in submesh 1, etc... So, you can iterate over the submeshes until you find the one your triangle belongs within: ...


5

The default shaders in Unity 5+ use something called physically-based rendering. This means they try to model a number of quirks we observe in real materials, which aren't included by the Lambertian/Phong approximations that have been popular in games in the past. One of those effects is Fresnel reflection, where the shiny reflection off of a surface ...


4

When importing a texture, you can set two different 'wrap modes'. These tell the renderer what to do when the UV map goes past the edges of the texture. Yours is set to 'clamp', which will just stretch the pixels on the edge. This is useful for preventing artifacts when rendering sprites, but in this case you will want to set it to repeat. Note that in 2D ...


3

If you want to change a Material in Unity you have to retrieve it first. If your GameObject uses a Material it means that it uses a Renderer. You can retrieve your object renderer using the internal variable renderer or get it using the GetComponent function. On the renderer object you will find a material property containing the active Material. For ...


3

Resolved! effect.texture2d0.envMode = GLKTextureEnvModeDecal; It is related to the Texture Environment Parameters, i.e. how OpenGL combines the diffuse color of the material with the texture value. As described here: khronos.org/opengles/sdk/1.1/docs/man/glTexEnv.xml. If I'm right that GLKit instruction should correspond to: glTexEnvi(GL_TEXTURE_ENV, ...


3

A material is what you apply to geometry to give it a colour and pattern. A texture is a component of a material. A shader is a small program that allows this material to be rendered at runtime. The nice thing about shaders is that you can do everything from simply rendering the material, to adding dynamic effects like specular highlights and reflections ...


3

To quote directly from the link you provided: For instance, OpenCTM does not handle multiple meshes, transformation matrices, materials, light sources, physical properties, etc. So, the answer is it does not have built in material support. However, it also says 'Supports storage of per-vertex normals, UV coordinates and custom vertex attributes.' This ...


3

A quick and dirty solution might be to get the position and intensity of nearby light sources and calculate intensity/distance for each, taking the greatest value to be the light level (if you're just after relative levels rather than pure accuracy, such as you might want when making a minecraft clone and deciding whether creatures spawn or not depending on ...


3

Scripts put in a folder named Editor affect Unity's editor, rather than running when you play the game. You can use this functionality to extend the capabilities of the editor, to run custom functions you create. For example, here's a script that adds a window with buttons for custom functions: http://wiki.unity3d.com/index.php?title=FindMissingScripts You ...


3

It looks like the Wings3D object doesn't have texture coordinates. There is a texture applied, it's just not applied correctly. Without texture coordinates, it'll just stretch a single pixel of the texture over the entire object.


3

You need to edit your shader source file in order to add "Cull Off" inside, more info here If you are not writing your own shaders (and so use default provided Unity shaders) then you can look at proposed solutions here


3

In a simple case you can change the main albedo color of the material of an object by assigning a different Color to gameobject.renderer.material.color Note that some advanced materials have multiple color properties which serve different purposes. In that case Material.color might not be the color you actually want to change and you have to use the ...


3

Here's an example of what you can do with a single material and a shader that changes behaviour based on world position: This shader looks something like this: Shader "Unlit/WorldspaceSwitch" { Properties { _Color ("Surface Color", Color) = (1, 1, 1, 1) _UnderColor ("Underground Color", Color) = (0, 0, 0, 0) } SubShader {...


3

When you set the UVs for your model, make sure the faces which are supposed to have a different material get assigned to different images. When you then import the model into Unity, you will have a different material-slot for each image in your model. You can then drag-and-drop different materials into those. Another option is to use one material for ...


3

First, create a simple mesh (such as a quad or a cube). Place it over top the actual game area, and stretch it so that it covers the entire camera view. Next, create a new shader named "ObscurityShader", and paste in the following shader code: Shader "Custom/ObscurityShader" { SubShader { Tags{"Queue" = "Transparent+1" "RenderType" = "...


2

According to UDN, the SRGB setting in the texture's properties has to be turned off (false) for normal maps and other textures that need exact values.


2

If you modify a material, it affects the objects that are using it. You need to duplicate that material, modify its texture and reassign it to the target object.


2

You need two vertexes in such this case. There is no way around it. If the faces have a different texture then you will need a different vertexes to define them. To simplify it you could try to save the mesh in such way - check whatever modelling program you use. Sometime it may be as simple as telling it not to weld vertexes together.


2

To apply different textures based on height the general method is to, in a pixel shader; Find the height of the geometry at the current pixel position. Perform a texture lookup on the heightmap that defines the geometry or just find the position of the current geometry as you would for lighting and find the y component. Supply your shader with some kind ...


2

If you want to create a transparent material you have to make your material "translucent". Glass also has the property that its surface is very shiny, so you also have to change the "Translucency Lighting Mode" to "Surface", otherwise you can not control highlights on the surface. Be sure to adjust the "Opacity" output pin of your material. You can have a ...


Only top voted, non community-wiki answers of a minimum length are eligible