ThreeJS: how add PointLight to scene with PNG textures?Shadows dont work with three.js3DS Max => ThreeJs. Export sceneUpdate texture map in ThreeJSShadows black even when a light is on top of itThreejs switch sceneOverlapping PointLight Shadows using MeshLambertMaterialthreejs - morphTargets shrink other meshes in sceneThreeJS: White PNG image loaded as texture, used as material and rendered as plane has grey edgesLoading ALL textures from a URL in ThreeJSThreeJS scene with textures, why toDataUrl return black JPG?

What is the purpose of the goat for Azazel, as opposed to conventional offerings?

How come the nude protesters were not arrested?

Rebus with 20 song titles

Importance of Building Credit Score?

SQL counting distinct over partition

How to safely destroy (a large quantity of) valid checks?

Russian word for a male zebra

Using "subway" as name for London Underground?

Meaning of 'lose their grip on the groins of their followers'

How can I end combat quickly when the outcome is inevitable?

Giant Steps - Coltrane and Slonimsky

Winning Strategy for the Magician and his Apprentice

Should I give professor gift at the beginning of my PhD?

Tabular make widths equal

Colloquialism for “see you later”

Generate basis elements of the Steenrod algebra

Union with anonymous struct with flexible array member

Certain search in list

How can I make some of my chapters "come to life"?

Which languages would be most useful in Europe at the end of the 19th century?

Someone whose aspirations exceed abilities or means

Is it expected that a reader will skip parts of what you write?

Determining fair price for profitable mobile app business

A IP can traceroute to it, but can not ping



ThreeJS: how add PointLight to scene with PNG textures?


Shadows dont work with three.js3DS Max => ThreeJs. Export sceneUpdate texture map in ThreeJSShadows black even when a light is on top of itThreejs switch sceneOverlapping PointLight Shadows using MeshLambertMaterialthreejs - morphTargets shrink other meshes in sceneThreeJS: White PNG image loaded as texture, used as material and rendered as plane has grey edgesLoading ALL textures from a URL in ThreeJSThreeJS scene with textures, why toDataUrl return black JPG?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a scene with one mesh with PNG textures. I taken PointLight code from ThreeJS example and added to my project:



 var intensity = 15;
var pointLight = new THREE.PointLight( color, intensity, 20 );
pointLight.castShadow = true;
pointLight.shadow.camera.near = 1;
pointLight.shadow.camera.far = 60;
pointLight.shadow.bias = - 0.005;


But I not see light and shadows on my mesh:



no light and shadows on mesh



I created a codepen for reproduce this case



How I can resolve this issue?










share|improve this question




























    0















    I have a scene with one mesh with PNG textures. I taken PointLight code from ThreeJS example and added to my project:



     var intensity = 15;
    var pointLight = new THREE.PointLight( color, intensity, 20 );
    pointLight.castShadow = true;
    pointLight.shadow.camera.near = 1;
    pointLight.shadow.camera.far = 60;
    pointLight.shadow.bias = - 0.005;


    But I not see light and shadows on my mesh:



    no light and shadows on mesh



    I created a codepen for reproduce this case



    How I can resolve this issue?










    share|improve this question
























      0












      0








      0








      I have a scene with one mesh with PNG textures. I taken PointLight code from ThreeJS example and added to my project:



       var intensity = 15;
      var pointLight = new THREE.PointLight( color, intensity, 20 );
      pointLight.castShadow = true;
      pointLight.shadow.camera.near = 1;
      pointLight.shadow.camera.far = 60;
      pointLight.shadow.bias = - 0.005;


      But I not see light and shadows on my mesh:



      no light and shadows on mesh



      I created a codepen for reproduce this case



      How I can resolve this issue?










      share|improve this question














      I have a scene with one mesh with PNG textures. I taken PointLight code from ThreeJS example and added to my project:



       var intensity = 15;
      var pointLight = new THREE.PointLight( color, intensity, 20 );
      pointLight.castShadow = true;
      pointLight.shadow.camera.near = 1;
      pointLight.shadow.camera.far = 60;
      pointLight.shadow.bias = - 0.005;


      But I not see light and shadows on my mesh:



      no light and shadows on mesh



      I created a codepen for reproduce this case



      How I can resolve this issue?







      three.js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 18:00









      tolyantolyan

      114114




      114114






















          1 Answer
          1






          active

          oldest

          votes


















          1














          There were multiple problems with your pen:




          • You have to tell the renderer to globally enable shadow maps like so:



            renderer.shadowMap.enabled = true



          • You have to tell the extruded shape to receive shadows:



            mesh.receiveShadow = true;


          • The extruded shaped used MeshBasicMaterial in your pen. This is an unlit material which means it does not react on lights. The codepen below now uses MeshPhongMaterial. You might want to consider to add an ambient or hemisphere light so all parts of your mesh are lit.


          Codepen: https://codepen.io/anon/pen/vPPJxW?editors=1010



          three.js R102






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326824%2fthreejs-how-add-pointlight-to-scene-with-png-textures%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            There were multiple problems with your pen:




            • You have to tell the renderer to globally enable shadow maps like so:



              renderer.shadowMap.enabled = true



            • You have to tell the extruded shape to receive shadows:



              mesh.receiveShadow = true;


            • The extruded shaped used MeshBasicMaterial in your pen. This is an unlit material which means it does not react on lights. The codepen below now uses MeshPhongMaterial. You might want to consider to add an ambient or hemisphere light so all parts of your mesh are lit.


            Codepen: https://codepen.io/anon/pen/vPPJxW?editors=1010



            three.js R102






            share|improve this answer





























              1














              There were multiple problems with your pen:




              • You have to tell the renderer to globally enable shadow maps like so:



                renderer.shadowMap.enabled = true



              • You have to tell the extruded shape to receive shadows:



                mesh.receiveShadow = true;


              • The extruded shaped used MeshBasicMaterial in your pen. This is an unlit material which means it does not react on lights. The codepen below now uses MeshPhongMaterial. You might want to consider to add an ambient or hemisphere light so all parts of your mesh are lit.


              Codepen: https://codepen.io/anon/pen/vPPJxW?editors=1010



              three.js R102






              share|improve this answer



























                1












                1








                1







                There were multiple problems with your pen:




                • You have to tell the renderer to globally enable shadow maps like so:



                  renderer.shadowMap.enabled = true



                • You have to tell the extruded shape to receive shadows:



                  mesh.receiveShadow = true;


                • The extruded shaped used MeshBasicMaterial in your pen. This is an unlit material which means it does not react on lights. The codepen below now uses MeshPhongMaterial. You might want to consider to add an ambient or hemisphere light so all parts of your mesh are lit.


                Codepen: https://codepen.io/anon/pen/vPPJxW?editors=1010



                three.js R102






                share|improve this answer















                There were multiple problems with your pen:




                • You have to tell the renderer to globally enable shadow maps like so:



                  renderer.shadowMap.enabled = true



                • You have to tell the extruded shape to receive shadows:



                  mesh.receiveShadow = true;


                • The extruded shaped used MeshBasicMaterial in your pen. This is an unlit material which means it does not react on lights. The codepen below now uses MeshPhongMaterial. You might want to consider to add an ambient or hemisphere light so all parts of your mesh are lit.


                Codepen: https://codepen.io/anon/pen/vPPJxW?editors=1010



                three.js R102







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 26 at 9:44

























                answered Mar 25 at 10:55









                Mugen87Mugen87

                4,8362624




                4,8362624





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326824%2fthreejs-how-add-pointlight-to-scene-with-png-textures%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript