Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

material(...) operator #5

Open
vvoovv opened this issue Nov 14, 2014 · 2 comments
Open

material(...) operator #5

vvoovv opened this issue Nov 14, 2014 · 2 comments

Comments

@vvoovv
Copy link
Owner

vvoovv commented Nov 14, 2014

texture(...) and color(...) are considered to be shortcuts for a more general material(...). Example usage of material(...):

# Use Blender material with the name "MyMaterial" for the current shape
material("MyMaterial")
# Create a material with the given parameters and apply it to the current shape
material(diffuseColor=..., otherParamer=..., oneMoreParameter=..., )
# Use Blender material with the name "MyMaterial" for the current shape if the material already exists,
# otherwise create a material with the given parameters and apply it to the current shape
material("MyMaterial", diffuseColor=..., otherParamer=..., oneMoreParameter=..., )
@vvoovv vvoovv changed the title Implement material(...) operator material(...) operator Nov 15, 2014
@vvoovv
Copy link
Owner Author

vvoovv commented Dec 2, 2014

A more consistent solution to define materials and textures in Prokitektura.

A material composed of a number of textures can be specified by the material(...) operator:

material(
    # texture for diffuse color
    texture("image_file_name", width_in_world_units, height_in_world_units),

    # one more texture for diffuse color, e.g. a dirt map
    texture("image_file_name2", width_in_world_units2, height_in_world_units2),

    # texture for normal map, note the special word "normal" as the last attribute
    texture("image_file_name3", width_in_world_units, height_in_world_units, normal),

    # optional, a base diffuse color
    diffuse = "#00ff00",

    # optional, the name of a custom Blender material to be used instead of that material
    name = "custom_name"
)

material(...) can contain any number of texture definitions texture(...)
Each subsequent call of material(...) on the same shape replaces the previous material.

If only one texture is needed, a shortcut version can be used. Just call texture() without wrapping it into material(...)

texture("image_file_name", width_in_world_units, height_in_world_units)

It's equivalent to:

material(
    texture("image_file_name", width_in_world_units, height_in_world_units)
)

In that case a designer may replace the material defined by prokitektura with a custom one, if the custom material has the name "image_file_name".

@vvoovv
Copy link
Owner Author

vvoovv commented Dec 2, 2014

Open issues:
How to call a Blender material defined by material(...) if name=... isn't provided? A lot of Blender material can be generated if there is a need to have some randomness in textures for windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant