Scripting code for 3D model rendering of normal maps

Source: Internet
Author: User

Reprint http://blog.csdn.net/games_maker/article/details/43935835

These days to study the next Wooyoogame technology, the site of the 3d display implementation seems very simple look oh, I did a simple tutorial for everyone

Inside the script feel is not difficult, a bit like the look of JSON, by configuration can be made to show the

Go to http://www.wooyoogame.com?sp=209 to register an account, then click on the game development (install a plugin) can write scripts

1. Export the model (remember to adjust the ratio unit 1 to 1 meters), otherwise the model will be very large or ultra-small

2. Upload the exported obj model and texture image to the platform

3. Read the model in the IDE and create the model

Loadmodel ("Testmdl", ":/tiantian/orge.obj", "obj");
Create (
{
Type: "Mesh";
Model: "TESTMDL";
});

The display effect is as follows

4. Read the model diff texture file

Clear ();

Loadmodel ("Testmdl", ":/tiantian/orge.obj", "obj");
LoadImage ("Bodyimg", ":/tiantian/body_dif.jpg");
LoadImage ("Weaponimg", ":/tiantian/weapon_dif.jpg");
Create (
{
Type: "Mesh";
Model: "TESTMDL";//Modeling Information
Geometries:
{
{index:0,texture: "weaponimg"};//sub-model 0 settings
{index:1,texture: "bodyimg"};//sub-model 1 settings
};
});

Haha, now the basic effect came out, the back is to adjust more effects

5. Read the normal map texture and add a more complex shader configuration

Clear ();
Loadmodel ("Testmdl", ":/tiantian/orge.obj", "obj");
Smoothmodel ("testmdl");
LoadImage ("Bodyimg", ":/tiantian/body_dif.jpg");
LoadImage ("Body_nimg", ":/tiantian/body_nor.jpg");
LoadImage ("Weaponimg", ":/tiantian/weapon_dif.jpg");
LoadImage ("Weapon_nimg", ":/tiantian/weapon_nor.jpg");
Create (
{
Type: "Mesh";
Model: "TESTMDL";//Modeling Information
Geometries:
{
{
index:0;
Shader
{
Type: "Normalmapex";
Texture: "Weaponimg";
Diffusemap: "Weaponimg";
Normalmap: "Weapon_nimg";
};
};//Sub-model 0 settings
{
Index:1;
Shader
{
Type: "Normalmapex";
Texture: "Bodyimg";
Diffusemap: "Bodyimg";
Normalmap: "Body_nimg";
};
};//Sub-model 0 settings
};
});

6. Have the normal effect, you can see the orc veins, now we are adding some detail settings, such as createmipmap to generate mipmap texture and light adjustment

Clear ();
Loadmodel ("Testmdl", ":/tiantian/orge.obj", "obj");
Smoothmodel ("testmdl");
LoadImage ("Bodyimg", ":/tiantian/body_dif.jpg");
Createmipmap ("bodyimg", 16);
LoadImage ("Body_nimg", ":/tiantian/body_nor.jpg");
Createmipmap ("body_nimg", 16);
LoadImage ("Weaponimg", ":/tiantian/weapon_dif.jpg");
Createmipmap ("weaponimg", 16);
LoadImage ("Weapon_nimg", ":/tiantian/weapon_nor.jpg");
Createmipmap ("weapon_nimg", 16);
Create (
{
Type: "Mesh";
Model: "TESTMDL";//Modeling Information
Geometries:
{
{
index:0;
Shader
{
Type: "Normalmapex";
Texture: "Weaponimg";
Diffusemap: "Weaponimg";
Normalmap: "Weapon_nimg";
ambient:{0.5,0.5,0.5};
Diffuse: {0.7,0.7,0.7};
Specular: {0.3,0.3,0.3};
};
};//Sub-model 0 (weapon) settings
{
Index:1;
Shader
{
Type: "Normalmapex";
Texture: "Bodyimg";
Diffusemap: "Bodyimg";
Normalmap: "Body_nimg";
ambient:{0.5,0.5,0.5};
Diffuse: {0.7,0.7,0.7};
Specular: {0.3,0.3,0.3};
};
};//Sub-model 1 (body) settings
};
});

You can create a connection by saving the script, and you can see it online.

Http://www.feekood.com/?path=:/tiantian/ShowOrge.ais

Scripting code for 3D model rendering of normal maps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.