Shader Forge Primary Article | Application of reflective MATERIAL

Source: Internet
Author: User
Tags unity 5

The reflection effect is often needed to create a game scene, especially in marble and ceramic materials that help to enhance the texture and ambience of the scene.

Speaking of reflection, the common practice in the game is to use the current scene cubemap as a reflection source
And CubeMap is the result of the current scene +skybox.

A production CubeMap

    • Sky Ball "online can be downloaded to a lot. Unitypackage, only the new version of Unity 5.0 after the Skybox moved to Lightmap settings, the old version under Rendersettings set"
    • CubeMap "5.3. Version 4 in this case the third level resource directory created cubemap, the old version in the second level directory can be found"
    • Create a sphere in the center of the scene, where you think you can reflect the panorama
    • Create the CubeMap script code "new JS script in the Editor folder of the resource directory Rendercubemapwizard, paste the following code in it"
//Render scene from a given point to a static cube map.//Place this script in Editor folder of your project.The cubemap with one of reflective shaders! class rendercubemapwizard extends scriptablewizard {    varRenderfromposition:transform;varCubemap:cubemap; function onwizardupdate () {helpstring ="Select Transform to render from and cubemap to render into"; IsValid = (renderfromposition! =NULL) && (CubeMap! =NULL); } function onwizardcreate () {            //create temporary camera for rendering            varGo =NewGameobject ("Cubemapcamera", Camera);//Place it on the objectGo.transform.position = renderfromposition.position; Go.transform.rotation = quaternion.identity;//Render into CubeMapGo. Getcomponent.<camera> (). Rendertocubemap (CUBEMAP);//Destroy temporary cameraDestroyimmediate (GO); } @MenuItem ("Gameobject/render into Cubemap")Static  function rendercubemap () {Scriptablewizard.displaywizard.<rendercubemapwizard> ("Render cubemap","render!"); }    }
    • For a moment, the script compiles a new render into CubeMap button under the Gameobject menu bar, opening
      and drag and drop the sphere sphere and the CubeMap object to the position. When you are done, click render! in the lower right corner. ——————— CubeMap can be generated in seconds

Second, using Shaderforge to make reflective shader

    • Simple Forge Shader
      Texture 2d– Model Diffuse map
      cubemap– the CubeMap file that was just generated
      cubemap– control the reflective strength of CubeMap [you can also use other variables not unique]
      multiply– multiplication node is responsible for multiplying the reflection intensity

    • After generating shader back to the scene resource folder, the scene of a ground map material ball shader replaced with our own production of shader can, effect!

PS: Of course you can also DIY to increase the self-light increase the high-light method is not fixed

Shader Forge Primary Article | Application of reflective MATERIAL

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.