Jump to content
  • Advertisement

RSI

Member
  • Content count

    45
  • Joined

  • Last visited

  1. Hi everyone! Just wanted to let everyone know that ShaderMap 4 (SM4) has been released and is now free for non commercial use. You can learn more at the new website https://shadermap.com Thanks for checking it out! Neil
  2. Developing ShaderMap 3 at the Moment
  3. RSI

    ShaderMap 2.0.7 Update

    The latest update of ShaderMap brings improved normal to displacment conversion with additional controls for contrast and height. There are other new features as well including linear magnification on preview image controls, additional zoom controls, and a map control button to refresh source images from file. Next up... ShaderMap 2 R1 I'll be rebuilding the normal editor which means implementing a layer system, adding a stencil brush for painting displacement/normals, adding shapes using a vector library, an eraser tool for rasterized layers, and line/box/oval/curve gizmos. Wish me luck. _Neil
  4. RSI

    Blending Normal Maps

    ShaderMap 2 currently implements overlay and detail oriented methods (called pure rotation in SM2) for painting normals. I may do a write up of the SM2 blending modes and maths behind them in the future. In the meantime here is a really great article I found on blending a detail normal map with a base normal map. http://blog.selfshadow.com/publications/blending-in-detail/ In other news, I'm on Google+ here: Neil Kemp and I've started a G+ page for ShaderMap as well: ShaderMap+
  5. RSI

    Still alive

    I care. Please stay alive. Unless you transfer into the singularity then you know.. it's cool. How much for beach front on the oblivion lake? I'm buying early in hopes it cools to a useful resource.
  6. RSI

    Woody3D Discontinued

    Wow, you guys really like the name Woody3D. I don't... I was never happy using a phallic (almost comical) name for the tree lib. Not sure why I settled on it other than it seemed easy to remember and usually made people smile. I'm wondering if you ever used Woody3D in a project or if you know anyone that did? My numbers suggest that it was never very popular.
  7. RSI

    Woody3D Discontinued

    [quote name='Servant of the Lord' timestamp='1342639344'] What are you going to do with Woody3D in it's current state? Open source it? [/quote] I'm going to use Woody's math library, geometry classes, and animation systems, to build a new tool for creating trees and plants. Open sourcing it is not something I want to do at the moment.
  8. Working on SM2 full force at the moment.
  9. RSI

    Woody3D Discontinued

    Thanks for your comments. If you create a tool that is useful and easy to use it will be popular no matter what it is named. And hey! It's not like I'm tossing out the knowledge and algorithms.
  10. I just killed Woody3D. Think I need a drink.
  11. RSI

    Woody3D Discontinued

    I'll just post what I wrote on the woody3d.com website, then I'll explain... [color=#0066cc]"Woody3D was developed by Neil Kemp at Rendering Systems Inc. as an inexpensive solution for developers to bring fully animated trees and foliage to their applications and engines. Woody3D was discontinued in July 2012. [/color] [color=#0066CC]Real-time tree generation and animation remain a core focus for Neil and Rendering Systems. In the future they'll place a higher emphasis on modeling tools and less on source code integration."[/color] Woody3D was a long term comitment for me. Three years of development. I wanted to create affordable real-time trees for developers. Why did it fail? Simple, the technology was complex and not easily integrated into today's popular engines. It focused more on source code integration and had a very nerdy user inteface. It should have focused on a simple intuitive interface (draw the tree - grab and bend the branches, etc.) with easy export to popular file formats. So that's what I plan to do. Start again. I believe I can take what learned from Woody3D (and ShaderMap 2) to build a better (single) tool to generate fully animated 3D trees and plants for video games, simulations, and software rendering systems. I can't fail if I don't quit. The Woody3D Field of Trees video will remain online:
  12. Each map in ShaderMap 2 is a plugin. The plugin is a Windows DLL with the file extension .smp. To create a map plugin you will need to download the ShaderMap 2 SDK. http://shadermap.com/downloads/ As of this tutorial I am using version 2.0.5. You will also need Visual Studio 2008 - 2010. Once you have the SDK downloaded and unzipped navigate to the folder 'map'. Inside you will see the VS solution file called map.sln. This solution contains 3 project files. Each project builds an example map. The 3 maps demonstrate how to build: - source maps - maps with no inputs - maps with inputs For the purpose of this tutorial I will be focusing on the third project. Right click on the project 'example_3' and set it as the default project. Open the source file 'example_3.cpp' so you can follow along. Each map plugin uses the file 'map_plugin_core.cpp' which contains all API functions for interacting with ShaderMap 2. It is included at the top of each plugin file. Each map plugin must implement 4 functions that are prototyped in the 'map_plugin_core.cpp' file. They are: [source] // Initialize plugin - Called when the plugin is loaded. // This tells ShaderMap about the plugin and sets up the plugin property controls BOOL on_initialize(void); // Process plugin - called each time the map needs to be regenerated - the map_id is used to gain access to the map property values. BOOL on_process(unsigned int map_id); // Called just before the plugin is unloaded when ShaderMap is shutdown. // If global resources are used this is the place to release them. BOOL on_shutdown(void); // Called when a project is loaded - It sends the version of the plugin with which the project was saved. // The values are arranged in the order 0,1,2,...property index. // If the order of the property controls have changed since the version parameter then modify the index array accordingly. void on_arrange_load_data(unsigned int version, unsigned int index_count, unsigned int* index_array);[/source] Here is the on_initialize function: [source]// Initialize plugin - This tells ShaderMap about the plugin and sets up the plugin property controls // Is called when the plugin is loaded by ShaderMap BOOL on_initialize(void) { // Tell ShaderMap we are starting initialize mp_begin_initialize(); // Set version - useful for tracking property changes // from version to version. See on_arrange_load_data() mp_set_version(101); // Tell ShaderMap this map plugin is type MAP mp_set_map_type(MAP_PLUGIN_TYPE_MAP); // Set name and description mp_set_name(_T("Example 3 Map")); mp_set_description(_T("An example of normal map plugin with 1 input.")); // Set the thumbnail filename. This image must be located in "APP_DIRECTORY\plugins\(x86|x64)\maps\thumbs" // See examples of thumbnails in that folder. // Thumbnail must be 128 x 128 pixels but thumb is much smaller at 71 x 71 and offset from top-left by 12 pixels mp_set_thumbnail(_T("example_3.png")); // Set default save format for the map mp_set_default_format(MAP_FORMAT_TGA_RGB_8); // Is a normal map mp_enable_normal_map(TRUE); // Add 1 input mp_add_input(_T("Normal Map"), _T("An image with normal vectors stored per pixel.")); // Add properties controls Property Index // Add a coodinate system property with a default coordinate system set mp_add_property_coordsys(_T("Coord System"), MAP_COORDSYS_X_POS_RIGHT | MAP_COORDSYS_Y_POS_DOWN | MAP_COORDSYS_Z_POS_NEAR, 0); // 0 // Tell ShaderMap initialize was success - map is added mp_end_initialize(); // Success return TRUE; }[/source] The first and last API calls are mp_begin_initialize(); and mp_end_initialize(); Everything else is between those two functions. Here we setup the version integer, the map type (source or map), the name and description, the thumbnail filename, default file save format, if the map is a normal map or not (if so then will require a coordinate system to be set), map inputs with a description, and property controls associated with the map. Here we have set up a map that is a normal map and takes a single normal map as input. It has one property control which is a coordinate system control. In essence this map allows the user to transform the normals of the input map to a new coordinate system. But you could make it do anything (randomize normals, etc). The on_process function is shown below: [source]// Process plugin - called each time the map needs to be regenerated BOOL on_process(unsigned int map_id) { // Local data unsigned int thread_limit, width, height, origin, tile_type, image_type, input_coord_system, user_coord_system, i, count_i; float x, y, z; const unsigned char* input_pixel_array_8; const unsigned short* input_pixel_array_16; unsigned char* map_pixel_d_array_8; unsigned short* map_pixel_d_array_16; // Get suggested thread limit for plugin process - not used in this example thread_limit = mp_get_map_thread_limit(); // ----------------- // Get size of input width = (int)mp_get_input_width(map_id, 0); height = (int)mp_get_input_height(map_id, 0); if(!width || !height) { LOG_ERROR_MSG(map_id, _T("Invalid input size. Width or height is zero.")); return FALSE; } // Get origin of input origin = mp_get_input_origin(map_id, 0); // Get tile type of input tile_type = mp_get_input_tile_type(map_id, 0); // Get image type of input image_type = mp_get_input_image_type(map_id, 0); // As the input is a normal map - we must get its coordinate system input_coord_system = mp_get_input_coordsys(map_id, 0); // ----------------- // Tell ShaderMap the tile type of this map so children of this map inherit the tile type switch(tile_type) { case 0: mp_set_map_tile_type(map_id, MAP_TILE_NONE); break; case 1: mp_set_map_tile_type(map_id, MAP_TILE_X); break; case 2: mp_set_map_tile_type(map_id, MAP_TILE_Y); break; case 3: mp_set_map_tile_type(map_id, MAP_TILE_XY); break; } // ----------------- // Allocate map pixels and get pointer to input pixel array // 8 bit if(image_type == MAP_IMAGE_TYPE_8) { // Allocate 8 bit map pixels map_pixel_d_array_8 = new (std::nothrow) unsigned char[width * height * 4]; if(!map_pixel_d_array_8) { LOG_ERROR_MSG(map_id, _T("Failed to allocate map pixels.")); return FALSE; } // Get pixel array of input 0 input_pixel_array_8 = (const unsigned char*)mp_get_input_pixel_array(map_id, 0); } // 16 bit else { // Allocate 16 bit map pixels map_pixel_d_array_16 = new (std::nothrow) unsigned short[width * height * 4]; if(!map_pixel_d_array_16) { LOG_ERROR_MSG(map_id, _T("Failed to allocate map pixels.")); return FALSE; } // Get pixel array of input 0 input_pixel_array_16 = (const unsigned short*)mp_get_input_pixel_array(map_id, 0); } // ----------------- // Get property values user_coord_system = mp_get_property_coordsys(map_id, 0); // ----------------- // Set the map coordsys as defined by the user mp_set_map_coordsys(map_id, user_coord_system); // Get number of items in the pixel arrays count_i = width * height * 4; // 8 bit if(image_type == MAP_IMAGE_TYPE_8) { // For every pixel for(i=0; i
  13. RSI

    ShaderMap 2.0.5 Update

    A new version of ShaderMap 2 is now available for download. This version brings bug fixes, new features, and options. Some of the new features include: Support for OBJ quads Lockable and savable source maps Optimized GPU usage Option to override tile types for source maps Option to set default geometry for projects A V Brush vector reset button Keyboard shortcuts And last but not least, a built in support page For a complete list of updates visit http://shadermap.com/forums/showthread.php?tid=35 To download the latest version visit: http://shadermap.com/downloads Here is an image of the support page. With it you can get news and updates right in the app. I'll be posting another SDK tutorial later this week. This time of Map Plugins
  14. ShaderMap 2 allows users to create materials using the ShaderMap 2 SDK. A material can use any map in the ShaderMap project or load external image files such as cube maps. The material also provides a user interface wtih associated HLSL constants. To get started let's look at the basic structure of the ShaderMap 2 material file. Each material file is an XML file. It is made of two parts: Setup and FX. Material File Structure: ... SETUP ELEMENTS HERE ... The Setup Section The first section of the XML is the SETUP section. Information in this section defines the maps and properties that the material will use. The "setup" element requires 2 attributes: "name" and "description". There are 4 types of elements that can be added to the Setup Section: lighting, world, input, and texture. Lighting Element The lighting element takes the form: If lighting is set to 1 then the following constants will be sent to the shader: // Light data int g_light_count; float3 g_light_vector_array[4]; float3 g_light_color_array[4]; float g_light_specular_array[4]; float3 g_light_ambient_color; World Element The "world" element can be of type "matrix", "vector", or "position". This element tells ShaderMap to send world information about the object it is rendering. Matrix types are sent to the fx_name as float4x4. Vector types are sent to the fx_name as float3. Position types are sent to the fx_name as float3. 1. The "matrix" type has the additional attribute "define" which defines the matrix to be sent to the fx_name constant. It can be any combination of the following characters: 'w' - World matrix 'v' - View matrix 'p' - Projection matrix 'r' - Rotation matrix 'i' - Inverse of matrix 't' - Transpose of matrix Ex. Each matrix is multiplied by the next. The inverse and transpose are applied to whatever matrix has previously been created. A string of "wit" sends the world_inverse_transpose matrix A string of "wvp" sends the world_view_projection matrix A string of "ri" sends the inversed rotation matrix There is no scaling in ShaderMap or rather all matrices have a scale of 1.0. 2. The "vector" type has the additional attribute "define" which can be any one of the following values: "view" - The view vector in world space Ex. 3. The "position" type has the additional attribute "define" which can be on of the following values: "eye" - The eye position in world space "target" - The eye target position in world space "object" - The object position in world space Ex. Input Element The "input" element defines a property control that will appear in the map properties section when that map is selected. This element can be a "list", "slider", "checkbox" or "color" control. Each type has additional attributes specific to the type. Values of the current input are sent to the FX constant defined in "fx_name". List types are sent to the fx_name as int Slider types are sent to the fx_name as int Checkbox types are sent to the fx_name as bool Color types are sent to the fx_name as float3 1. The "list" type has the additional attributes: "prefix", "items", and "default". "prefix" - A prefix to the list. A list of colors might use "color: " "items" - A list of strings divided by the ; character. "A;B;C" "default" - The default item in the list. A zero based index (integer). Ex. 2. The "slider" type has the additional attributes: "name", "min", "max", and "default". "name" - The name shown next to the slider control "min" - The minimum value of the slider (integer) "max" - The maximum value of the slider (integer) "default" - The default value of the slider (integer) 3. The "checkbox" type has the additional attributes: "name" and "default" "name" - The name shown next to the checkbox control "default" - The default state 1 or 0. Ex. 4. The "color" type has the additional attributes: "name" and "default" "name" - The name shown next to the color control "default" - The default color of the control in HEX format. Ex. Texture Element The "texture" element tells ShaderMap to send a texture to ShaderMap. The texture can be from a Map or an image file. Two types of image files are allowed and they are standard images (jpeg, bmp, etc.) and cube maps (always dds). If any texture is sent to the shader then the tile constant is sent as well. It is a float2 and is always named g_uv_tile. Multiply this by all texture coords to get proper tiling. 1. The "map" type texture sends a user defined map to the shader. It has the additional attributes: "name", "desc", "is_normal", and "is_checkbox". "name" - The name of the map required by the shader. "desc" - A description of the map required by the shader. "is_normal" - Can be either 1 or 0. If set to 1 then the map sent should be a normal map. An additional constant is sent the the FX shader which contains the coordinate system of the normal map. It will take the form _coordsys. It is a float3 vector. It represents the coordinate system relative to the default tangent space used by ShaderMap. A vector of (1,1,1) means it is in X = +Right, Y = +Down, Z = +Near. A value of (1,1,-1) means that Y = +Up "is_checkbox" - Can be 1 or 0. If 1 then a checkbox control will be added to the properties that allows the user to disable sendingthis texture. Ex. 2. The "image" type texture sends an image from file to the shader. It has the additional attributes: "name", "file", and "is_checkbox". "name" - The name of the image shown only if is_checkbox is 1. "file" - The filename of the image to load as a texture. It is relative to the location of the material file. "is_checkbox" - Can be 1 or 0. If 1 then a checkbox control will be added to the properties that allows the user to disable sending this texture. 3. The "cube" type texture sends a DDS cube map from file to the shader. It has the additional attributes: "file" and "is_checkbox". "name" - The name of the cube map shown only if is_checkbox is 1. "file" - The filename of the cube map to load as a texture. It is relative to the location of the material file. "is_checkbox" - Can be 1 or 0. If 1 then a checkbox control will be added to the properties that allows the user to disable sending this texture. Ex. Ex. A Diffuse Lighting Material Setup: The FX Section The second section of the XML is the FX section. This section can include an entire Direct3D effect script enclosed in the CDATA section or can just be a link to a file in the same directory as the XML. Attributes for the "fx" element are "vsm", "psm", and "file". vsm is the maximum vertex shader model required by the material. psm is the maximum pixel shader model required. The file attribute is optional, if set the fx is loaded from an external file rather than from the CDATA section. Ex. file="external_shader.fx" Because ShaderMap uses DirectX 9c the maximum shader model supported is SHADER MODEL 3. To learn more about DirectX Effect files see the Direct3D9c documentation: http://msdn.microsof...9(v=vs.85).aspx http://msdn.microsof...8(v=vs.85).aspx or just google it: http://www.google.co...rect3D9 Effects Diffuse Lighting Material Here is a complete material example. It serves as a good starting point for creating your own materials. It takes one map as diffuse and uses per-pixel n dot l lighting for each of the project directional lights. ; }; // I/O structs struct VS_INPUT { float3 position : POSITION; float3 normal : NORMAL; float2 uv : TEXCOORD0; float4 tangent : TANGENT; }; struct VS_OUTPUT { float4 position : POSITION; float2 uv : TEXCOORD0; float3 normal : TEXCOORD1; }; // ============================================================== // Vertex shader VS_OUTPUT vs_main(VS_INPUT IN) { // Local data VS_OUTPUT OUT; // Store output position, UV, and normal OUT.position = mul(float4(IN.position, 1.0f), g_world_view_projection); OUT.uv = IN.uv * g_uv_tile; OUT.normal = mul(IN.normal, (float3x3)g_world_inverse_transpose); return OUT; } // Pixel (fragment) shader float4 ps_main(VS_OUTPUT IN) : COLOR { // Local data int i; float n_dot_l; float3 n, d, l; float4 c; // Get texture color c = tex2D(g_diffuse_sampler, IN.uv); // Get normal n = normalize(IN.normal); // Base light color d = float3(0.0f, 0.0f, 0.0f); // Calculate diffuse light color for(i=0; i And here is it running in ShaderMap 2: You can download the full material file here: Diffuse Lighting Material To install the XML material file - place it in the following directory: C:\Program Files\ShaderMap 2\plugins\materials\ For more information and examples download the free ShaderMap SDK: http://shadermap.com/downloads
  15. RSI

    GPU-powered path tracing, take two

    Agreed, that looks nice! Though I've never written a tracer, I've always wanted to. Will be watching and reading.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!