Raymond
Demo: Green Dragon

Articles with the tag: Materials

Animated materials

[17/03/14 16:14]

Control nodes should have access to the timer (as should autonomous nodes*) but materials should be given the option in case the material is animated.

  • Control nodes could inherit from InteractiveNode and AgencyNode, to distinguish between nodes that take input or not. Or: AgencyNode can be overloaded with an Input class to turn it into an "InteractiveNode".

[17/03/14 20:13]

Models should load their own meshes and materials, but ResMan should check to see if mesh/material exists before loading it again. Could perhaps remove get_mesh() and get_material() methods and simply return directly with the load_mesh() and create_material() methods.

[17/03/14 20:40]

ModelNodes should have meshlists and associated shader lists, to be able to render submeshes.

Read More »


Data type: Materials

Material contains texture GLuints.

Could shared_ptr<void> be used to save different types of materials?

Try polymorphism. If that doesn't work, try <void> (using abstract Material class).

resman->CreateTexture(texturename, filename);
Texture = resman->GetTexture(texturename);
// Or:
Texture = resman ->GetDefaultTexture(); // Return white texture in case pure colour is wanted.
// So:
resman->CreateMaterial(string matname, make_shared<SomeMaterial>(Texture, diffusecol, etc));
someMaterial = SomeMaterial{Texture* tex, GLUint texobject};
someMaterial->LoadTextures{tex -> texobject};
modelNode = ModelNode{someMaterial->LoadTextures};

Presumably need:

someMaterial->BindTextures;
someMaterial->UnbindTextures;

To be called when program is loaded, before rendering.

This is in keeping with the memory management rule: ResMan controls HDD->Host, and SceneGraph elements control Host->Device.

[04/03/14 13:41]

So how to load textures... How does WebGL do it?

DDS is a compressed image format directly compatible with openGL texture buffer objects. GLFW handles Targas for some reason.

WebGL uses the browser's image loading capabilities. OpenGL ...

Read More »


ResMan and Material interaction

Material(Diffuse, Shader, Program, Texture)

ResMan->CreateMaterial(Diffuse, Shader, Texture...)

But this isn't a very flexible way of making a new material. It restricts to only one type, unless I make createMetalMaterial() for example. No good for shaders which need weird attributes.

  • Load meshes, materials, textures with ResMan.
  • Grab resource pointers with ModelNode.

Read More »


Data type: Material

ModelNode contains base diffuse texture which most materials should be aware of.

Material can contain other dynamic or attribute textures to be applied after the diffuse.

Read More »


Resource Management

It would appear that the ResMan's job is to pull needed resources from the HDD (meshes, materials...) for scene use, and:

  • Associates an ID with every scene element and refcounts it. (could use a map for IDs)
  • Prevents the SceneNode from containing its own mesh, materials.
  • Can do batch loading.
  • Can specify default materials for models.

Materials can contain uniform diffuse colour buffer for now, which will help controlling a number of objects at the same time. Can move this control into the ModelNodes if individual object diffuse control (or other constant attributes) is needed.

[10/02/14 14:31]

To use ASSIMP or not? WebGL doesn't have ASSIMP, so maybe good practice to use lower-level parsers.

JSON is a data exchange format.

Can use JSON parser library for C++ and JS.

Read More »


Shaders and lighting

Shadow maps should only be used on dynamic objects and lights.

[05/02/14 14:10]

Can draw arbitrary points using glDrawArrays(GL_POINTS, 0, 1); which could be useful for a raytracer. Then again, it'd be better to manipulate a texture buffer and display that.

This is, however, good for graphing: draw points, but don't clear.

Material inputs

[05/02/14 15:16]

From above link:

"With traditional lighting model, there is often a RGB diffuse texture, RGB specular texture, specular mask texture, constant specular power and normal map."

"For advanced material you can add specular power texture, Fresnel intensity texture, Fresnel scale texture, reflection mask texture..."

[05/02/14 15:29]

Shader requires a diffuse texture.

  • Node -> Contains object-specific textures.
  • Material -> Contains shader.

[05/02/14 21:54]

It would appear that one uses the uniform keyword for standard inputs to shaders such as time. Should this ...

Read More »


Page 1 / 2 Older »