Blog

Webmasters! 3 Ways to 3D Web

2014-08-01

This article explains how to place Blend4Web content on websites.

Method #1 (Simplest): Self-Contained HTML File

The possibility to export scenes from Blender to a single HTML file is one the most exciting features of Blend4Web. Such a file is an all-sufficient web page that can be opened with any standard browser and shared through any means (via email, USB drive/memory card, cloud storage, etc). You can, of course, share it online too. Particularly, you can upload and embed it in a website using iframe for which you can set the dimensions and specify other properties such as allowfullscreen:

<iframe allowfullscreen src="path/to/apple.html" width="800" height="500"></iframe>

The main advantage of this method is its simplicity. Blend4Web newbies can follow these steps:

  • 1. Download and install Blend4Web;
  • 2. Export a pre-created scene via Blender menu File > Export > Blend4Web (.html);
  • 3. Upload the HTML file to your website and embed it with iframe.

Of course, you can use HTML files as standalone web pages without any embedding too.

Method #2 (More Optimized): Web Player + JSON

The second method is an alternative to the first and the result seemingly looks the same: 3D content with control elements is embedded in a web page.

Nevertheless, this method of embedding is different: instead of a single HTML file, a combination of the Web Player and a separate JSON file is used.

<iframe allowfullscreen src="path/to/webplayer.html?load=path/to/apple.json" width="800" height="500"></iframe>

Where do you get the Web Player? You can copy the whole directory blend4web/deploy/apps/webplayer/ with the Web Player files from your Blend4Web SDK and deploy it on your website.

JSON files can be exported in the same way as the HTML files File > Export > Blend4Web (.json). Upload your exported .json file (with the accompanying .bin file and possible textures) to your website and specify the path to it with the load attribute. Both absolute and relative URLs are supported.

Learn more about features of the Web Player in the corresponding section of the User Manual.

Note

If you try to launch this app locally (not from a remote web server), it won't run due to the same-origin policy. For loading and viewing exported .json files we recommend using the Project Manager. With the Project Manager you can also create production-ready apps based on the Web Player without the need to copy files manually.

While this method looks a bit more complicated, it offers several benefits. Exported scenes are:

  • 1. smaller and can be loaded faster;
  • 2. capable to be used by programmed apps other than the standard Web Player;
  • 3. designed to allow you to use Blend4Web's physics engine;
  • 4. decoupled from the Web Player's code and are not subject to the licensing as it is with HTML files.

Method #3 (Customizable): Interactive 3D Web App

Finally, we can convert the web page itself into an interactive 3D application! Let's demonstrate this with a simple example: we'll place a button on this page to trigger interesting animation.

Check it out: the page content can be viewed through translucent animated balloons with volumetric highlights. Plus, there is a magical sound!

The stripped version can be seen live here. The source files can be found in this SDK folder: apps_dev/tutorials/web_page_integration/.

How this animation effect was created is described in this article. Now, let's look at how it was integrated with this page. This isn't any more difficult than making something similar with jQuery or the fading Flash.

Note

Once again, it is very convenient to use the Project Manager to create a full set of application files (HTML, CSS, JS) and modify them instead of creating everything from scratch.

First of all, you should link the Blend4Web JavaScript library b4w.min.js that you can copy from your SDK. The logic is coded in separate script file called example.js:

<script type="text/javascript" src="b4w.min.js"></script>
<script type="text/javascript" src="example.js"></script>

Then we add div elements for the rendering area and the button:

<div id="canvas_cont"></div>
<div id="run_button"></div>

The script for this small app is very short. It starts with a module declaration and then it imports required Blend4Web modules. The app initializes a WebGL context first. Pay attention to the init parameters: div element id is supplied to canvas_container_id yet transparency is enabled with alpha:

exports.init = function() {
    m_app.init({
        canvas_container_id: "canvas_cont",
        callback: init_cb,
        alpha: true
    });
}

Then the .json file is loaded:

m_data.load("path/to/flying_letters.json", load_cb);

After the loading is complete, the load_cb() callback is fired. Inside this function, we can start manipulating our 3D scene. First, we stop the armature animation because it was set to auto-play in Blender settings (our 3D artist used skeletal animation for balloons and it was convenient for him to tweak the animation outside the app).

var letters_arm = m_scs.get_object_by_name("beads_armature");
m_anim.stop(letters_arm);

Then we attach a mousedown event listener to our button:

run_button.addEventListener("mousedown", demo_link_click, false);

Every time the button is clicked the demo_link_click() function is called. Inside it we play sound...

var spk = m_scs.get_object_by_name("Speaker");
m_sfx.play_def(spk);

...and run the animation of flying balloons. So simple!

var letters_arm = m_scs.get_object_by_name("beads_armature");
m_anim.apply(letters_arm, "flying_letters");
m_anim.play(letters_arm, letters_obj_cb);

After all the balloons fly out from the bottom and are positioned in a row, we switch their animation to idle:

m_anim.apply(obj, "flying_letters_idle");
m_anim.set_behavior(obj, m_anim.AB_CYCLIC);
m_anim.play(obj);

That's it!

In Closing

WebGL gives the unique opportunity to seamlessly integrate interactive 3D content with other web technologies. With Blend4Web, you can easily create such content with Blender, deploy it on web pages and combine it with any HTML elements.

Changelog

[2014-08-01] Initial release.

[2014-10-22] Updated file paths.

[2014-10-30] Updated links to the web player. Added allowfullscreen attribute. Removed deprecated bg parameter.

[2014-12-03] Added sound.

[2015-04-23] Updated file path to webplayer sources. Updated variable and animation names. Removed deferred_rendering and context_antialias parameters from m_app.init() function.

[2015-05-15] Added CSS style description. Rendering area resize logic replaces from script to CSS table. Added link to standalone application. Added resize() function description.

[2015-12-10] Removed app.js module.

[2016-02-11] Fixed css.

[2016-04-08] Standalone B4W add-on is no longer mentioned to discourage its use. Fixed links. Removed show_fps URL attribute to simplify things. Added info about the Project Manager. Removed all CSS code and simplified code explanation.

[2016-06-16] Added the possibility to use physics to the benefits list of the second method. Clarified other items in that list.

[2016-09-21] Added an advice to use the Project Manager for creating apps.

[2017-01-12] Minor changes in the text.

[2017-03-22] Updated the link to the licensing options. Fixed the links to the #3 app sources.

Comments
11 jun. 2021 09:57
I AM SELLING Fresh Cc & Fullz With Good And High Balance of $K
Also got new updated Valid CC (Credit Card) For 10$ and 99% Validity
With Full Info Which Is Good For Online shopping and Online Payment
Shopping Should

—–D++p Zone—–
USA ( Track 1 and Track 2 ): $60

USA ( Track 1 and Track 2 with ATM
PIN ): $120

UK ( Track 1 and Track 2 ): £50

UK ( Track 1 and Track 2 with ATM
PIN ): £120

CA ( Track 1 and Track 2 ): $60 Btc

CA ( Track 1 and Track 2 with ATM PIN ): $140
My Dumps With Pin is Hitting From 20K To 30k Warranty and 100%works good for cashout ……..


I DO LEGIT AND CLEAN WU TRANSFER HERE …YOU FIRST TRACK MTCN BEFORE YOU MAKE PAYMENT..AND NEED ONLY SERIOUS CUSTOMER'S ONLY FOR LONG TERM BUSINESS..

$150 for $1500
$200 for $2000
$400 for $5000

NOTE: I will send the transfer to your address then send you MTCN to track the payment when you see payment available then you send payment


I DO LEGIT AND INSTANT CASH APP TRANSFER WITH NO CHARGE BACK FOR LONG TERM..

$150 for $1500
$200 for $2000
$400 for $5000


I DO LEGIT AND INSTANT PAYPAL TRANSFER TRANSFER WITH NO CHARGE BACK FOR LONG TERM

$150 for $1500
$200 for $2000
$400 for $5000

HEY MEMBERS I GOT YOU THIS SHIT

[+]ID ME Bypass method
[+]Personal Lookups ssn, Dob, Mmn , Dl
[+]DL Lookuplockup
[+]New SBA Loan Method
[+]Tax refund 2021
[+]Pua Methods and walkthrough
[+]Cashapp method
[+]Bank logs
[+]Wells Fargo cashout method
[+]DL lookups ( site available for sale)
[+]ID/dL scan available
[+]Pros with dL all states
[+]sba docs
[+]Tax refund new method
[+]sba new method


.Contact support ICQ: 748441620
.Whatsapp : +84935462769
.Telegram :@acesellers7979 ( https://t.me/acesellers7979 )
Warning !!!
Someone is impersonating me.Be careful. i'm Username @Acesellers7979 (telegarm) Not Acesellers79797 or Aceseller7979 or Acesellers797979
A lot of customers have been cheated
11 jun. 2021 09:57
I AM SELLING Fresh Cc & Fullz With Good And High Balance of $K
Also got new updated Valid CC (Credit Card) For 10$ and 99% Validity
With Full Info Which Is Good For Online shopping and Online Payment
Shopping Should

—–D++p Zone—–
USA ( Track 1 and Track 2 ): $60

USA ( Track 1 and Track 2 with ATM
PIN ): $120

UK ( Track 1 and Track 2 ): £50

UK ( Track 1 and Track 2 with ATM
PIN ): £120

CA ( Track 1 and Track 2 ): $60 Btc

CA ( Track 1 and Track 2 with ATM PIN ): $140
My Dumps With Pin is Hitting From 20K To 30k Warranty and 100%works good for cashout ……..


I DO LEGIT AND CLEAN WU TRANSFER HERE …YOU FIRST TRACK MTCN BEFORE YOU MAKE PAYMENT..AND NEED ONLY SERIOUS CUSTOMER'S ONLY FOR LONG TERM BUSINESS..

$150 for $1500
$200 for $2000
$400 for $5000

NOTE: I will send the transfer to your address then send you MTCN to track the payment when you see payment available then you send payment


I DO LEGIT AND INSTANT CASH APP TRANSFER WITH NO CHARGE BACK FOR LONG TERM..

$150 for $1500
$200 for $2000
$400 for $5000


I DO LEGIT AND INSTANT PAYPAL TRANSFER TRANSFER WITH NO CHARGE BACK FOR LONG TERM

$150 for $1500
$200 for $2000
$400 for $5000

HEY MEMBERS I GOT YOU THIS SHIT

[+]ID ME Bypass method
[+]Personal Lookups ssn, Dob, Mmn , Dl
[+]DL Lookuplockup
[+]New SBA Loan Method
[+]Tax refund 2021
[+]Pua Methods and walkthrough
[+]Cashapp method
[+]Bank logs
[+]Wells Fargo cashout method
[+]DL lookups ( site available for sale)
[+]ID/dL scan available
[+]Pros with dL all states
[+]sba docs
[+]Tax refund new method
[+]sba new method


.Contact support ICQ: 748441620
.Whatsapp : +84935462769
.Telegram :@acesellers7979 ( https://t.me/acesellers7979 )
Warning !!!
Someone is impersonating me.Be careful. i'm Username @Acesellers7979 (telegarm) Not Acesellers79797 or Aceseller7979 or Acesellers797979
A lot of customers have been cheated
11 jun. 2021 09:57
I AM SELLING Fresh Cc & Fullz With Good And High Balance of $K
Also got new updated Valid CC (Credit Card) For 10$ and 99% Validity
With Full Info Which Is Good For Online shopping and Online Payment
Shopping Should

—–D++p Zone—–
USA ( Track 1 and Track 2 ): $60

USA ( Track 1 and Track 2 with ATM
PIN ): $120

UK ( Track 1 and Track 2 ): £50

UK ( Track 1 and Track 2 with ATM
PIN ): £120

CA ( Track 1 and Track 2 ): $60 Btc

CA ( Track 1 and Track 2 with ATM PIN ): $140
My Dumps With Pin is Hitting From 20K To 30k Warranty and 100%works good for cashout ……..


I DO LEGIT AND CLEAN WU TRANSFER HERE …YOU FIRST TRACK MTCN BEFORE YOU MAKE PAYMENT..AND NEED ONLY SERIOUS CUSTOMER'S ONLY FOR LONG TERM BUSINESS..

$150 for $1500
$200 for $2000
$400 for $5000

NOTE: I will send the transfer to your address then send you MTCN to track the payment when you see payment available then you send payment


I DO LEGIT AND INSTANT CASH APP TRANSFER WITH NO CHARGE BACK FOR LONG TERM..

$150 for $1500
$200 for $2000
$400 for $5000


I DO LEGIT AND INSTANT PAYPAL TRANSFER TRANSFER WITH NO CHARGE BACK FOR LONG TERM

$150 for $1500
$200 for $2000
$400 for $5000

HEY MEMBERS I GOT YOU THIS SHIT

[+]ID ME Bypass method
[+]Personal Lookups ssn, Dob, Mmn , Dl
[+]DL Lookuplockup
[+]New SBA Loan Method
[+]Tax refund 2021
[+]Pua Methods and walkthrough
[+]Cashapp method
[+]Bank logs
[+]Wells Fargo cashout method
[+]DL lookups ( site available for sale)
[+]ID/dL scan available
[+]Pros with dL all states
[+]sba docs
[+]Tax refund new method
[+]sba new method


.Contact support ICQ: 748441620
.Whatsapp : +84935462769
.Telegram :@acesellers7979 ( https://t.me/acesellers7979 )
Warning !!!
Someone is impersonating me.Be careful. i'm Username @Acesellers7979 (telegarm) Not Acesellers79797 or Aceseller7979 or Acesellers797979
A lot of customers have been cheated
11 jun. 2021 15:07
https://drivinglicenceforsaleonline.com/contact-us/
Why do we need a driver's license? Authentic legal driving license online | I am selling a driver's license. https://drivinglicenceforsaleonline.com/contact-us/
A driver's license is an important and essential document in the life of every adult, https://drivinglicenceforsaleonline.com/ it must be drawn up and delivered with a certain regularity and legality so as not to endanger the user and his environment. https://drivinglicenceforsaleonline.com/driving-license/ Do you need this important document, but don't know how to do it? Do you want to improve your driving license? https://drivinglicenceforsaleonline.com/about-us/
Buy Driver's License Online, Buy Driver's License El Salvador, Where To Buy Driver's License, Types Of Driver's License, Buy Driver's License, Kingdom Of Spain Driver's License, Buy Trout Driver's License, Buy Driver's License, Buy Driver's License In Spain, Sell Driver's License , Motorcycle Driver's License, https://drivinglicenceforsaleonline.com/how-to-order/ Has your driver's license been suspended due to the use of drugs or alcohol? Contact us (whatsapp +33 6 44 63 31 60) to facilitate the purchase of a new driver's license. https://drivinglicenceforsaleonline.com/testimonials/
Safe and reliable services are guaranteed. https://koopeenrijvangenisonline.com/
You need a driver's license to buy a car, exchange your European driver's license online, buy a registered real European driver's license | instant EU driver's license, buy real EU driver's license, buy driver's license, online driver's license, https://drivinglicenceforsaleonline.com/faqs/ how to buy a car without driver's license, buy driver's license, buy EU driver's license online, buy registered driver's license, buy a Spanish driver's license without test, a real driver's license for sale online, https://drivinglicenceforsaleonline.com/contact-us/ buy a registered driver's license, buy a real driver's license, buy a driver's license, buy a Spanish driver's license, buy a registered driver's license, buy a driver's license online for sale, buy a driver's license registered driver's license, https://drivinglicenceforsaleonline.com/blog/ driver's license application for online sales, driver's license application for online sales, car purchase without a driver's license, online driver's license purchase, https://driverslicenceforsale.co.uk/
11 jun. 2021 15:07
https://drivinglicenceforsaleonline.com/contact-us/
Why do we need a driver's license? Authentic legal driving license online | I am selling a driver's license. https://drivinglicenceforsaleonline.com/contact-us/
A driver's license is an important and essential document in the life of every adult, https://drivinglicenceforsaleonline.com/ it must be drawn up and delivered with a certain regularity and legality so as not to endanger the user and his environment. https://drivinglicenceforsaleonline.com/driving-license/ Do you need this important document, but don't know how to do it? Do you want to improve your driving license? https://drivinglicenceforsaleonline.com/about-us/
Buy Driver's License Online, Buy Driver's License El Salvador, Where To Buy Driver's License, Types Of Driver's License, Buy Driver's License, Kingdom Of Spain Driver's License, Buy Trout Driver's License, Buy Driver's License, Buy Driver's License In Spain, Sell Driver's License , Motorcycle Driver's License, https://drivinglicenceforsaleonline.com/how-to-order/ Has your driver's license been suspended due to the use of drugs or alcohol? Contact us (whatsapp +33 6 44 63 31 60) to facilitate the purchase of a new driver's license. https://drivinglicenceforsaleonline.com/testimonials/
Safe and reliable services are guaranteed. https://koopeenrijvangenisonline.com/
You need a driver's license to buy a car, exchange your European driver's license online, buy a registered real European driver's license | instant EU driver's license, buy real EU driver's license, buy driver's license, online driver's license, https://drivinglicenceforsaleonline.com/faqs/ how to buy a car without driver's license, buy driver's license, buy EU driver's license online, buy registered driver's license, buy a Spanish driver's license without test, a real driver's license for sale online, https://drivinglicenceforsaleonline.com/contact-us/ buy a registered driver's license, buy a real driver's license, buy a driver's license, buy a Spanish driver's license, buy a registered driver's license, buy a driver's license online for sale, buy a driver's license registered driver's license, https://drivinglicenceforsaleonline.com/blog/ driver's license application for online sales, driver's license application for online sales, car purchase without a driver's license, online driver's license purchase, https://driverslicenceforsale.co.uk/
19 jun. 2021 21:21
I cant Publish a website. Its not finding my FTP Folders. Have to do it with FileZilla. Then it works. Also cant center my Page in the Browser. Anybody has any answers? Thank you

Друзья, вы вообще пробовали когда-нибудь делать тренировки на силу?
Я просто был в ужасе от этого, я едва не травмировал свой организм.
<a href=http://kirkoroval.beget.tech>Команда</a> помощников мне конечно помогла, и я стал выполнять упражнения более с умом
19 oct. 2021 14:05
skdrlbsdjk37909453

https://hhowtoknow.xyz/
https://hhowtoknow.com/
baplie viewer download for windows 10download free fast vpn for pcdownload wifi hotspot windows 10windows 8.1 enterprise evaluation iso free downloadbest buy microsoft office professional 2016 free downloaddc universe online game download pc freevip72 download for windows 8 freefree download os windows xp sp3 full version iso freedownload itunes on pc windows 7pixelmator pro or affinity photo free download
https://bit.ly/3lRCO8U
https://bit.ly/2VJT9Bw
https://bit.ly/3lR1oX9
https://bit.ly/3xLigRO
https://bit.ly/3ArRW0C

f1 2007 pc game download
windows 10 the missing manual pdf download free
itunes download file location windows 10
among the sleep free download pc full version
hp laserjet p1007 driver download for windows 10 64 bit
11 nov. 2021 09:54
Return lost love spells- Call Mama musubo +27632739717 Seychelles Magic lost love spells caster am Traditional healer, Lost love spells caster, Money spells, lost Love Spells, Astrology, Spell caster, Love Spells caster Marriage spells, Johannesburg spells caster, Ancient Magic Spells, Attraction Spells, Magic rings, Psychic reader, Binding spells, Spiritual healer, Success Spells, Barrenness problems, Promotion spells, Divorce spells, court cases, Banishing Native healer, voodoo dolls. I was born and raised on the coastal areas of Tanzania Mombasa Regions. My parents moved to South Africa when I was 16 due to some miraculous signs I had developed Bringing me South Africa they thought they had took me away from what I was meant to be.
Love spells that work fast to fix love problems, lost love spells to get back with an ex-lover, love spells to chase away love rivals & love spells to protect your your lover
Return lost love spells- Call MAMA MUSUBO +27632739717
Voodoo Spell Caster & Spell Master. 37 Years experience 100% Positive Results!
Love Spell Specialist • Here To Help You Healing, Love And Relationships.
Private and Confidential. Call Now
Lost Love/ Marriage/ Divorce Call For Immediate Help Now- Come See Natural Spiritual Traditional Healing powers at its best. Call / What's App On +27632739717 .MAMA MUSUBO Email:mamamusubo@gmail.com
https://web.facebook.com/Stronglovesangoma https://web.facebook.com/PowerfulSangomahealer
Web: https://www.safemagiclovespells.com
25 nov. 2021 20:27
The cheap logo design services is today the most loved because it holds become a crucial part of any company. It's the initial representation of your brand , and tells the real story of your business and creates an actual brand. We provide creative, latest and trendy designs and logos which helps your company stand out among the millions. Our company has designed a vast array of logos representing different brands. It has made a significant influence on the industry thanks to its imaginative designs and logos
30 nov. 2021 19:11
Joining our site is free and easy - so easy that in just minutes we can open up exciting possibilities for meeting japaneese brides women and maybe a japaneese brides Beauties from this country have a gentle character, so do not approach them if you have frivolous intentions. The girls are here in the shower like princesses - they adore chivalry, manners and honest conversations under the moon. If you date local girls, you will feel like a real knight in shining armor, in love with a gentle princess.
Please register or log in to leave a reply.