Implementation of transparent texture material in ogre

Source: Internet
Author: User
Tags transparent image

In game modeling, generally, the number of trees and plants are produced in the form of "transparent blank Textures", saving surface and accelerating game performance, is a "cost-effective" method.

But when you join ogre.

The exported mesh file does not play any role in the Ogre scenario. Bugs:

 

After improvement:

Material 01-Default

{

Technique

{

Pass

{

Lighting off

Scene_blend alpha_blend

Depth_check off

Ambient 0 0 0 1

Diffuse 0 0 0 1

Cull_hardware none

Cull_software none

Texture_unit

{

Texture g.png

}

}

}

}

Bold twoCodeIs to open the transparent mode,

Then, the texture uses an image with an alpha channel. The transparency is a transparent image.

It is equivalent to saying that there is nothing in the texture, that is, the direct transparency is 0. JPG and other formats do not contain Alpha transparent channels.

There is also a way to achieve transparency but there will be problems:

The method of modifying the. Material material file is adopted when the object material is transparent. The following is an example of the modification:
Material jirouxiaojirou2
{
Technique
{
Pass
{
Ambient 0 0 0 1
Diffuse 1 1 1 1
Specular 0 0 0 1
Emissive 0 0 0
Scene_blend add
Depth_check on
Texture_unit
{
Texture long.jpg
Tex_coord_set 0
Colour_op modulate
Scale 1 1
Scroll 0 0
Rotate 0
}
}
}
}
The bold part is the key to the transparency of objects, but now we have a problem that objects can be transparent. However, once the light is too strong, the exposure will become white and the light will be weak, the surroundings will become very dark again. Is there a way to make the environment look very bright without affecting the transparency effect? Or is there a problem with my transparent method? Which of the following experts has a better solution to object transparency? One of the two pictures below is the current transparent effect, and the brighter one is what I hope to achieve.

The problem with the above method comes from the Internet and is also a transparent method, but it is better than the first method.

 

2010. I have a monkeyjs post. All Rights Reserved. You are welcome to reprint it. Please respect the work of the blogger and repost the source in a text box.

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.