Start a new topic

texture lightning problems

Dear Wikitude-Team,


I created a syringe, in C4D Prime R18. All the materials are made with C4D buit-in materials, except the label. The syringe is illuminated by the "infinite light".


When I import it into the WikitudeEncoder, the label seems to be twice as strong illuminated than on the rest; no shadows visible.


Do you know why the light affects the label material this way, and how to prevent this?


I tried a workaround and bake the shadow into the texture and exclude the label object from the lightsource, but again it seems to shine too bright.


Another workaround was to bake the whole object and delete the light source. This looks good on one part of the syringe, but the transparent part is not visible as transparent anymore. I dont know why, because the only difference to the transparent material from before is of course the baked picture set as texture.


Is it possible to show transparent materials with pictures as textures in Wikitude?


When I play around with the light, it seems not to affect the object in the WikitudeEncoder as well. It is either on, or off. (changes in the brightness, additional lightsources will not be visualized)


Best regards, Doris Lehner

fbx
fbx
preview.png
(1.3 MB)

Good morning Doris,



I'm afraid I can't investigate the ambient setting myself, as I do not have C4D available. But only this single material has the 1, 1, 1 ambient term set, all the other materials have no ambient term at all. You can verify this yourself by checking the content of the exported wt3 file.


Simply rename the .wt3 file to a .zip file and extract it. This will yield a folder named "model". Within it, you will find a "model.material" file. This being a simple text file, you can open it with any tex editor and check the properties of the exported materials. Here is is the relevant excerpt:

 

material Plastic_Dot_Grid_2 : textured
{
    u_ambientColor = 1, 1, 1
    u_cameraPosition = CAMERA_WORLD_POSITION
    u_specularColor = 0.53, 0.53, 0.53, 1
    u_specularExponent = 12.996
    u_worldViewMatrix = WORLD_VIEW_MATRIX
    
    sampler u_diffuseTexture
    {
        path = tex/Bild4.png
        mipmap = true
        wrapS = REPEAT
        wrapT = REPEAT
    }

    renderState
    {
        cullFace = false
        depthTest = true
    }
    
    technique
    {
        pass 
        {
            defines = DIRECTIONAL_LIGHT;SPECULAR
        }
    }
}

 

Removing the "u_ambientColor = 1, 1, 1" line and re-zipping the file is all I did to fix it.


From what I can tell based on a quick Google search, there is no global ambient light setting for the entire scene in Cinema4D as it is available in other 3D modelling software. It seems any light source can be turned into an ambient light term. Maybe you have one such light in your scene that only affects this particular material?


Regarding transparency, having the alpha values embedded into the textured is, as you have discovered, one way to go. Another would be to introduce the transparency with the "u_diffuseColor" material property. Some of your materials, "Mat_1" and "Mat_2" for example, are already doing this. Here's the relevant excerpt:

 

material Mat_1 : colored
{
    u_cameraPosition = CAMERA_WORLD_POSITION
    u_diffuseColor = 1, 1, 1, 0.87
    u_specularColor = 0.2, 0.2, 0.2, 0.87
    u_specularExponent = 32
    u_worldViewMatrix = WORLD_VIEW_MATRIX
    
    renderState
    {
        blend = true
        cullFace = false
        depthTest = true
        dstBlend = ONE_MINUS_SRC_ALPHA
        srcBlend = SRC_ALPHA
    }
    
    technique
    {
        pass 
        {
            defines = DIRECTIONAL_LIGHT;SPECULAR;TEXTURE_DISCARD_ALPHA
        }
    }
}

 

To my understanding, this should also yield transparent geometry.



- Daniel

Good morning Daniel,


thank you for your replies.


Strong illumination on materials: I checked all the settings on my materials, but I could not find anything to set an ambient term to 1, 1, 1. Neither did I find anything else i did not try already to prevent the material from illuminating so strong. Maybe it is some sort of incompatibility of C4D and Wikitude?


Same goes for the alpha value, no values provided a satisfying result in the wikitude encoder. 

BUT one thing I tried worked:

My material contained a baked jpg texture and a transparency value. Transparency settings did not work, so I uploaded a png that is -in my case- 50% transparent as texture. 

Now I can see the transparent material in the WikitudeStudio and as AR on my target.


Best regards, Doris

Amendment regarding your second question:


It should be possible to have a textured material that is transparent. The alpha value of the texture will be used for the calculation of the final alpha, though. So the texture being used will have to have an alpha channel and alpha value <1.


- Daniel


Good morning Doris,



the strong illumination of your label mesh part is caused by its material having an ambient term of (1, 1, 1) set. That's not the case for all the other sub-mesh materials. I'm afraid the 3D encoder application does not show this material property to you for whatever reason.


Could you check whether you can verify this setting in Cinema4D?


I attached a WT3 file of your model with the ambient term removed.



- Daniel



wt3
(829 KB)
Login or Signup to post a comment