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
07 apr. 2021 02:29
抛物线SAR
根据Wilder的估计,抛物线SAR最适合趋势证券,它们大约占30%的时间。这意味着该指标在超过50%的时间或当证券不趋势时容易被鞭打。毕竟,SAR旨在赶上趋势并像跟踪止损一样跟随趋势。与大多数指标一样,信号质量取决于基础安全性的设置和特征。正确的设置以及良好的趋势可以产生一个很好的交易系统。错误的设置将导致鞭打,损失和挫败感。没有黄金定律或一刀切的设置。每种证券应根据其自身特征进行评估。抛物线SAR也应与其他指标和技术分析技术结合使用。例如,在考虑信号之前,可以使用Wilder的平均方向指数来估计趋势的强度。
解释
SAR跟随价格,可以被视为趋势跟随指标。一旦下降趋势反转并开始,SAR就会像跟踪止损一样跟随价格。只要上升趋势保持不变,止损就持续上升。换句话说,SAR永远不会在上升趋势中下降,并且会随着价格的上涨而不断保护利润。该指标可防止降低止损的趋势。一旦价格停止上涨并在SAR以下反转,则开始下降趋势,SAR高于价格。 SAR跟随价格走低,就像跟踪止损一样。只要下降趋势继续,止损就连续下跌。因为SAR永远不会在下降趋势中上升,所以它会持续保护空头部位的利润。
https://www.freeforex-signals.com/
步长增量
如电子表格示例所示,该步长(也称为加速因子(AF))是一个乘数,会影响SAR的变化率。 SharpCharts用户可以设置步长和最大步长。随着趋势的扩展,阶跃逐渐增加,直到达到用户设置的最大值。步骤决定了SAR指示器的灵敏度。
forex signals
SAR灵敏度可以通过减小阶跃来降低。较低的步骤可以使SAR远离价格,这使得逆转的可能性较小。同样,可以通过增加步长来提高SAR灵敏度。较高的幅度将使SAR更加接近价格走势,这使得逆转的可能性更大。如果将步长设置得太高,指示器将经常倒转。这将产生鞭打而无法捕捉趋势。

图6显示了具有SAR(.01,.20)的IBM。步长为.01,最大步长为.20。图7显示IBM的步骤(.03)较高。图表7中的SAR更为敏感,因为存在更多的反转。这是因为图表7(.03)中的“步进”高于图表6(.01)的“步进”。
08 apr. 2021 14:37
Ammo Board is an online ammunition shop to fulfill your Bulk Ammo needs. In stock ammo deals available for Handgun, Rimfire, Shotgun & Rifle. We offer free shipping for all Bulk Ammo orders. All of the Ammunition listed on our website is in stock and ready to ship. With offering low price & fast shipping service, Our goal at Ammo Board is to provide you excellent services & the best prices.

Find 223 ammo for sale at ammoboard.com, by looking for caliber, brand, and more. We have a large stock of Bulk Ammo for sale. All of the ammunition listed on our website is in stock and ready to ship. Shopping with the Ammo Board and you can save big.

Ammo Board is the prominent supplier of ammunition. We offer ammo in bulk, box, and case quantity. Browse our collection of ammo for your Handgun, Rifle, Pistol, Shotgun & Rimfire, and choose ammunitions according to your desire.
We offer special price deals on:-
10mm Ammo
Bulk 9mm Ammo
17 Hmr Ammo
9mm Ammo
223 Ammo
Browse us today and get free and fast shipping.
08 apr. 2021 18:14
ピボットポイント
ピボットポイントは、チャーティストに価格の方向性を決定し、サポートとレジスタンスのレベルを設定する方法を提供します。価格の方向は、ピボットポイントを基準にした現在の期間の価格アクションを調べることによって決定されます。ピボットポイントの上または下から開始するか、取引中にいずれかの方向に交差します。価格の方向性が決定された後、設定されたサポートポイントとレジスタンスポイントが機能します。もともとフロアトレーダー向けに設計されましたが、ピボットポイントの背後にある概念は、さまざまな時間枠に適用できます。

すべての指標と同様に、テクニカル分析の他の側面でピボットポイント信号を確認することが重要です。弱気のローソク足反転パターンは、2番目の抵抗での反転を確認できます。売られ過ぎのRSIは、2回目のサポートで売られ過ぎの状態を確認できます。 MACDの上昇は、サポートテストの成功を確認するために使用できます。

最後に、2番目または3番目のサポート/レジスタンスレベルがチャートに表示されない場合があります。これは単に、それらのレベルが右側の価格スケールを超えているためです。言い換えれば、彼らはチャートから外れています。
free forex signals

ピボットポイントは、チャーティストが方向性のある動きと潜在的なサポート/レジスタンスレベルを決定するために使用できる重要なレベルです。ピボットポイントは、前の期間の高値、安値、および終値を使用して、将来のサポートおよびレジスタンスレベルを推定します。この点で、ピボットポイントは予測または先行指標です。ピボットポイントには少なくとも5つの異なるバージョンがあります。この記事では、標準ピボットポイント、デマークピボットポイント、フィボナッチピボットポイントに焦点を当てます。
https://www.freeforex-signals.com/

ピボットポイントは元々、フロアトレーダーが主要なレベルを設定するために使用していました。現代のデイトレーダーのように、フロアトレーダーは短期的な焦点で非常に動きの速い環境で取引しました。取引日の開始時に、フロアトレーダーは前日の高値、安値、終値を見て、現在の取引日のピボットポイントを計算します。このピボットポイントをベースとして、サポート1、サポート2、レジスタンス1、レジスタンス2を設定するために、さらに計算が使用されました。これらのレベルは、1日を通して取引を支援するために使用されます。
03 may. 2021 11:52
Thank you for providing information on this interesting topic. I will update your next articles regularly. Please continue to uphold.
directions
03 may. 2021 11:54
Thank you for providing information on this interesting topic. I will update your next articles regularly. Please continue to uphold.
directions
12 may. 2021 04:29
价格渠道
价格通道可用于识别趋势反转或超买/超卖水平,这些水平表示较大趋势内的回调。上方通道线上方的浪涌显示出非凡的强度,可以预示上升趋势的开始。相反,下通道线下方的下跌表明严重的疲软,可能预示着下降趋势的开始。一旦上升趋势开始,图表绘制者可以将时间缩短到较短的时间,以识别读数超卖的回调。下通道线下方的移动表明超卖状态可能预示着回调的结束。同样,可以通过价格通道识别较大上升趋势中的短期反弹。在上方通道线上方移动表明信号超买,这可能预示着反弹结束。
趋势识别
价格通道可用于识别可能导致持续趋势逆转的强劲走势。基本上来说,突破20日价格通道意味着新的20日高点。突破20周价格通道则预示着20周新高。显然,20周高点比20天高点更重要。时间范围的选择取决于您的交易时间范围和使用价格渠道的理由。例如,图表专家可以使用具有20周价格通道的每周图表来确定大趋势和整体交易偏向。
Stock Recommendations
上面的图表显示了纳斯达克100 ETF(QQQQ)在4 1/2年内的每周价格。绿色箭头标志着上方通道线上方的每周高点,标志着上升趋势的开始。红色箭头标志着较低通道下方的每周低点,这标志着下降趋势的开始。这些频道中断引发了一些良好趋势,但出现了两次拉锯或不良信号。指示灯信号不完美,会有鞭打声。这只是游戏的一部分。
gold signals
可以使用封闭线图进一步过滤信号。第二张图表显示了相同的4 1/2年期限,其中20周的价格通道和QQQQ为封闭线图。这消除了周内的高点和低点。请注意,QQQQ在2008年5月的上方通道线上方或2010年5月的下方通道线下方均未关闭(蓝色箭头)。使用仅收盘价图表可以减少波动和信号。
类似于随机指标
当人们考虑随机震荡指标时,价格通道类似于随机震荡指标。该动量振荡器在给定的时间段内(例如20天)测量相对于高低范围的收盘价水平。当收盘价接近其20天范围的高端时,随机震荡指标相对较高,而当随机指标接近该范围的低端时,则震荡指标较低。
gold signals
让我们将20天快速随机震荡指标与20天价格通道进行比较。当价格超过上限价格通道时,随机震荡指标通常会高于80。同样,当价格跌破较低的价格通道时,20天快速随机震荡指标通常将低于20。由于价格通道数据以上一时期结束,因此时间上存在细微差异。另一方面,随机振荡器数据以当前周期结束。这意味着随机震荡指标包含最新的价格走势,而价格通道则不包含。然而,这两种方法几乎是同一件事。
https://www.gold-pattern.com/en
道琼斯工业平均指数SPDR(DIA)图表显示了带有20天快速随机震荡指标的20天价格通道(粉红色)。红线和绿线分别表示何时超买(在较高通道线附近)和超卖(在较低通道线附近)。随着随机震荡指标在50上下波动,价格在中心线上方和下方移动。
超买/超卖
使用价格渠道来衡量超买和超卖情况可能很棘手。证券可能会超买,并且在强劲的上升趋势中仍会超买。同样,证券可能会超卖,而在强劲的下降趋势中仍会超卖。在强劲的上升趋势中,价格可以移动至上方通道线上方并继续位于上方通道线上方。实际上,随着价格继续高于上通道,上通道趋势线将上升。从技术上看,这似乎超买,但这是保持超买实力的迹象。同样,随机震荡指标可以移动至80以上,这在技术上已超买,并在较长时间内保持超买状态。
成功使用超买和超卖水平取决于成功的趋势识别。一旦确定了较大的上升趋势,交易者便可以在较小的趋势中寻找超卖水平。在较大的上升趋势中出现回调之后,出现短期超卖水平。如上所述,当QQQQ飙升至上限通道线上方时,周线图转为看涨。一旦周线图看涨,交易者可以转向日线图以寻找超卖信号。每周图表代表较大趋势,而每日图表代表
17 may. 2021 14:16
I need to find more information about any types of revision, because I have some troubles with that.
27 may. 2021 06:27
This is my first time here and I found a lot of interesting things in your blog, especially the discussion section, thank you for sharing. There is much other interesting and interesting content. Come to experience: Little Alchemy
09 jun. 2021 18:17
Writing an assignment is not an easy task, apart from resources. You will need the idea of effective writing. Marketing gives away hard challenges to the students. They have to follow various journals, thesis to get a proper answer for the tricky question. While writing a marketing assignment, you need to write informative yet constructive solutions. Your assignment needs to be solid and practical, which will meet the expectation of the professors. Instead of investing your time in the assignments, it is better to seek for right marketing assignment help.
10 jun. 2021 10:16
Excellent article. It is very interesting to read. I really enjoy reading such a good article. Thanks! Continue to promote.
Little Alchemy
Please register or log in to leave a reply.