A resistive voltage divider is an arrangement of two resistances in series that allows us to have at the midpoint a fraction of the voltage at the ends.
Applications of a resistive divider
The divider with potentiometer is usually used as an analog input in the frequency driver of the motors. Using the potentiometer we change the speed of the motor.
A BJT transistor can also be polarized with a splitter, connecting the central point of the splitter to the base of the transistor.
Working principle of the resistive divider
In figure 1 we see an arrangement that can be used as a divisor.
Fig. 1: Generic resistive divider in LT Spice.
To understand how it works we must consider the potential drops in both resistances.
The voltage drop on a resistor is the current flowing through it multiplied by the resistive value.
We are going to analyze two cases, when the resistances are equal and when one is greater or less than the other.
Case 1: Equal Resistors
In this case we can intuit that the potential drop in both resistances will be the same (because the same current circulates through them and their resistive value is equal), therefore at the midpoint of the divisor we will have a voltage value equal to the mean value between the potential difference at the extremes.
In figure 2 we can see that the voltage in Vo is 2.5 Volts, half of the 5 Volts applied in the divisor.
With this result we may be tempted to say that the voltage at the midpoint of the divisor is going to be equal to half the value applied in V2, but this is not always the case.
This is only fulfilled if in V1 we have applied 0 Volts (in figure 2 V1 is grounded).
In figure 3 we see an example in which this is not fulfilled, in this case the potential difference in the divisor is still 5 Volts, but V1 is not grounded but has applied 5 Volts while V2 has 10 Volts.
The result is that in Vo we have half the applied potential difference plus the voltage V1.
Fig. 2: The voltage at the midpoint of the divisor is equal to half of the applied voltage.
Fig. 3: Voltage at Vo does not match half of the applied potential difference at the ends.
Case 2: Different Resistors
In figure 4 we consider R1 smaller than R2 and in figure 5 the opposite case.
Fig. 4: The voltage at Vo is greater than half the difference in potential applied at the ends.
Fig. 5: The voltage at Vo is less than half the potential difference applied at the ends.
Based on the results we can say that if 100% of the resistive value is 150 Ohms, 50 Ohms and 100 Ohms will be approximately 33% and 66% respectively.
These percentages seem to be reflected in the Vo voltage, as in Figure 4 the 3.3 V voltage is approximately 66% of 5 V while 1.6 V is approximately 33% of 5V.
Analogously to figure 3, we should not assume that this will always be so, we must remember to add the voltage applied in V1, we can see this in figures 6 and 7.
Fig. 6: The result in figure 4 must be added to the voltage applied in V1.
Fig. 7: The result of figure 5 must be added to the voltage applied in V1.
Formula deduction
Now that we have seen the working principle and some experiments we are going to find an expression for the voltage Vo that takes into account both resistances.
The voltage Vo will be equal to the voltage V1 plus the potential drop in resistance 2.
Vo = V1 + Vr2
The potential drop in R2 is equal to the current flowing through the resistance multiplied by the value of R2.
Vr2 = i x R2
Then:
Vo = V1 + i x R2
The current circulating through the divisor, by Ohm’s Law, is equal to the difference of potential applied at the ends divided by the sum of the resistances.
i = ( V2 – V1 ) / ( R1 + R2 )
Replacing the current in the previous expression we have:
Vo = V1 + R2 x ( V2 – V1 ) / ( R1 + R2 )
Here we already have an expression for Vo in which are all the variables of figure 1, however we can solve the sum and obtain a more compact expression.
Vo = ( R1 x V1 + R2 x V2) / ( R1 + R2 )
The Potentiometer
This element can be used as a variable resistive divider.
The potentiometer is basically two resistors that we can change value but the sum of both remains unchanged.
If we connect a potential difference at the ends, in the middle we will have a voltage that will be between the minimum voltage and the maximum of that potential difference.
Using the knob we can control the voltage in the central leg.
Conclusion
We have seen what a resistive divider is and what its working principle is.
Some applications can be to enter values in analog inputs of different control devices such as frequency inverters or logic controllers. Polarize transistors.
Introduction
In this post I’m going to show an industrial simulation that I did some time ago trying to combine automation with PLC and Unity graphical environment.
The experiment consists in the simulation of a pulp line made with the graphic engine Unity, the idea is similar to SCADA (control system and data acquisition) only in this case we only observe the states of the machines, there is no control.
The 3D models of the machines were made with Blender and then animated with programming in Unity.
In the simulation the machines can be switched on and off, the idea is that these machines are controlled with the information received from the Arduino via USB port.
Experiment Description
The idea is to control variables in Unity using an Arduino that is in charge of reading the states of the PLC outputs and with that to elaborate a word that is sent by USB to the PC and from Unity that word is interpreted and the corresponding changes are applied.
In the following video belonging to the channel of my other page I show the result of the simulation.
The synchronization problems seen in the video have already been solved using multi-threaded programming. I will probably do an article to show how the final version was used to simulate the operation of a cold room.
Conclusion
This industrial simulation was the basis for a job in which a PLC was used to control a process involving temperature sensors and frequency drivers to control the rotation of fans.
With Arduino, the states of the digital outputs of the PLC and the analog output are read to control the speed of the fans and this is sent in a 6-character word.
Unity takes this 6-character word and interprets what the state of the digital outputs is and what value is coming out of the analog port and the simulation adjusts to these values.
Introduction
In this article we will deduce how to calculate the resulting resistive value by placing resistors in parallel, i.e. connecting two or more resistors with their interconnected legs. In addition we will use LT Spice to verify these results.
Fig. 1: Example of an arrangement with two generic parallel resistors.
Analyzing figure 1 we can see that the voltage applied to each resistance is the same for all, what will generate a current in each of these, the total current of the source will be the sum of the currents by all the branches of the resistances.
Deduction
To begin the deduction let’s assume a simple circuit consisting of a V voltage source connected to the parallel resistor array, like the one illustrated in Figure 2.
Fig. 2: Circuit with voltage source and N resistors in parallel. In all resistances the same potential V falls.
On this circuit we are going to apply Kirchoff’s circuit Law for current, which tells us that a node the sum of all the currents that enter the node is equal to the sum of all the currents that leave the node. We consider as node a point that is between the voltage source and the union of all resistances.
In figure 3, in line 1 I have written what this law tells us considering that we have a finite number of resistances.
On line 2 I place the value of the currents in terms of voltage and resistance according to Ohm’s Law. The next step is to take out the voltage v as a common factor, since all resistors have the same voltage v applied.
Finally we conclude that what is in parentheses on line 3 is the value of a resistance for an equivalent circuit that instead of having n resistors has only one with this value. In figure 4 we see this equivalent circuit.
Fig. 3: Deduction of the equivalent resistance considering the circuit of the previous figure.
Fig. 4: Same circuit as above but considering that the voltage source is applied to a single resistor with equivalent value.
In figure 5 we have simulated a circuit with a voltage source of 1 Volt and two resistances of 100 Ohm connected in parallel, while in figure 6 we have a circuit with the same voltage source but only a resistance with the equivalent resistance value that would be 200 Ohms.
As can be seen in the posters with the result of the simulation, the current circulating through the voltage source is the same in both cases, so we can conclude that these circuits are equivalent.
Fig. 5: Simulation of a circuit with a 1 Volt source and two 100 Ohm resistors in parallel.
Fig. 6: Simulation of a circuit with a source of 1 Volt and a resistance of 200 Ohms.
Conclusion
We have analyzed a circuit with generic parallel resistances and applied the current laws to determine an equivalent expression of resistance.
When we have arrangements of resistances in parallel we know that these have applied the same tension in their extremes, applying Kirchoff’s circuit laws we can deduce an expression for the equivalent resistance.
Finally we have made a simulation to show that we can think of an equivalent circuit grouping the resistances.
Introduction
In this article we will deduce how to calculate the resulting resistive value by placing resistances in series, i.e. connecting two or more chained resistances. We will also use LT Spice to verify these results.
Fig. 1: Example of an arrangement with two generic value resistors in series.
If we think about the physical size of the resistors we realize what the result is going to be. Let’s suppose that we have identical resistances of 100 Ohms that measure 1 cm, if we place two of these resistances one after the other we would have two centimeters of resistive material, then intuitively we can say that two resistances of 100 Ohm in series will result in a resistive value of 200 Ohm.
This reasoning leads us to think that if we have resistors connected in series, their Ohmic value will be added.
Deduction
To begin the deduction let’s assume a simple circuit consisting of a V voltage source connected to the array of series resistors, as illustrated in Figure 2.
Fig. 2: Circuit with voltage source and N resistors in series. The same current i circulates through all the resistors.
On this circuit we are going to apply Kirchoff’s circuit Law for voltage, which tells us that a closed circuit the sum of all potential drops gives as a result 0.
In figure 3, in line 1 I have written what this law tells us considering that we have a finite number of resistances.
On line 2 I place all the resistors on the right side of the equation. The next step is to take the current i as a common factor, since this same current i circulates through all the resistances.
Finally we conclude that what is in parentheses on line 3 is the value of a resistance for an equivalent circuit that instead of having n resistors has only one with this value. In figure 4 we see this equivalent circuit.
Fig. 3: Deduction of the equivalent resistance considering the circuit of the previous figure.
Fig. 4: Same circuit as above but considering that the voltage source is applied to a single resistor with equivalent value.
In figure 5 we have simulated a circuit with a voltage source of 1 Volt and two resistances of 100 Ohm connected in series, while in figure 6 we have a circuit with the same voltage source but only a resistance with the equivalent resistance value that would be 200 Ohms.
As can be seen in the posters with the result of the simulation, the current circulating through the voltage source is the same in both cases, so we can conclude that these circuits are equivalent.
Fig. 5: Simulation of a circuit with a 1 Volt source and two 100 Ohm resistors in series.
Fig. 6: Simulation of a circuit with a source of 1 Volt and a resistance of 200 Ohms.
Conclusion
We have intuitively raised what the equivalent resistance value of a series resistor array might be.
When we have arrangements of resistances in series the current that circulates is the same in all, applying Kirchoff’s circuit laws we can deduce an expression for the equivalent resistance.
Finally we have made a simulation to show that we can think of an equivalent circuit grouping the resistances.
Introduction
Without a doubt a useful tool at the time of making tests of operation in the circuits is the Protoboard. In this article we are going to see what it is, sizes, accessories, internal connections and we are going to see examples of incorrect connection and correct connection of elements.
As we see in figure 1 is a plate that has a lot of holes where we can place our components.
Fig. 1: Two examples of protoboards.
Depending on the circuit that we want to implement we may need more than one Protoboard, it is good to know that most have sockets on their sides to fit plates of the same manufacturer.
Fig. 2: The protoboards have sockets that allow one after the other.
In addition in the market we can find certain accessories that we can use in the protoboard, like cables with male terminals and DC sources.
In the figures 3 and 4 we see an example of these sources that come prepared to place in the protoboard. We can feed it with transformer or with USB cable and train two switches that allow us to choose between 3.2V and 5V.
Fig. 3: Arduino Source ready to be connected to a protoboard.
Fig. 4: This source has a mini USB connection or transformer plug.
Pin Distribution
In figure 5 I have highlighted with colors to show how the electrical bridges under the dot matrix are made.
Fig. 5: Standard bridge of a protoboard.
At both ends of the board we see a red line indicated with a sign “+” and another blue with a sign “-“, these lines are used to provide voltage to our circuits.
In the middle in green color we have 60 lines of 5 points that we can use to make the interconnections of our circuit.
The 5 points on each line are bridged together under the board, which helps us reduce the amount of cables we need.
Another important detail is that we have numbers for the rows and letters for the columns so that we can identify each point of the Protoboard, for example A-1 is the first point at the top right in Figure 5 and J-30 is the last point at the bottom left.
How to connect elements in the Protoboard
When we have devices with several legs such as transistors or integrated circuits, it is important that we know what the internal distribution of bridges is like, otherwise we can make a mistake in the way they are connected.
In figure 6 we see examples of current and incorrect connections.
Fig. 6: Integrated circuits and resistors in protoboard. Badly connected in red, well connected in green.
For example take the case of the resistance connected at points G-24 and J-24, the 5 points on line 24 from the letter F to J are bridged to each other, so it makes no sense to connect a resistance at two of these points, the current will never flow through it.
Conclusion
The protoboard is a useful tool when testing the operation of our circuits.
Depending on the project, we will need larger or smaller plates, it is good to know that plates of the same type can be fitted using the side skirtings and that there are accessories that can facilitate the supply and connections of the elements.
It is important to know the distribution of the internal bridges of the plate, in this way we will avoid placing the elements badly.
Introduction
In this article we are going to see how to download and install LT Spice software to simulate electrical and electronic circuits. We will also create a simple circuit to test the program.
Download the software
First we will download the installer from the official website, click on the link below:
Fig. 1: On the official website we download the program according to our operating system.Fig. 2: The unloading process starts.
Once the download finishes we run it. In my case I got a screen saying that the installation was blocked by the Windows protection system, when I clicked on “More information” the button “Run anyway” appeared.
Fig. 3: Windows blocked the installation, clicking on More Information displays the Run anyway button.
We accept the terms and conditions and choose the installation location. In my case I leave everything by default.
Fig. 4: First we must accept the terms and conditions of the software.
Fig. 5: Choose the installation parameters and click Install Now.
At the end of the installation the program runs automatically, the sign appears in Figure 6 saying that the program is ready to run for the first time.
Fig. 6: At the end of the installation, the software prepares for the first run.
At the end of the process the main window of the program appears, and we are ready to start creating schematics and simulating electrical and electronic circuits.
Fig. 7: This is the main window of the simulation program
First we go to File > New Schematic, to create a new project, this can be seen in figure 8.
Fig. 8: To start with we create a new schematic.
The workspace appears in gray, here we will begin to build the schematic.
Let’s add elements, click on the AND gate button shown in figure 9.
Fig. 9: Button to add a component to the schematic.
This will display a window in which we can choose the components.
Power Source
To power our circuit we are going to need a voltage source, in the search bar of the components window we write “voltage” and select the generic source that can be seen in figure 10.
Fig. 10: In the window that appears write “Voltage”.
We place it in the workspace and right click on it, this will open a window to enter the parameters of the font, in my case I will use 5 Volts.
The “Advanced” button allows us to define advanced parameters of the source, such as signal type, frequency, period, duration, ascent and descent times, among others. For now we are only going to keep the DC source that comes by default.
Fig. 11: Right click on the voltage source to enter the value.
Resistors
Let’s add the resistor, press the button of the AND gate again (figure 9) and this time we write “resistor” in the search bar. Select the generic resistor shown in figure 12.
Fig. 12: Add the “resistor” component to the schematic.
We place it in the workspace and right click on it to enter the parameters.
For now we will only enter a resistance value of 1000 (the standard unit is Ohm, as we see in figure 13 between square brackets to the left of the value 1000).
Fig. 13: Right click on resistance to enter the values.
Wiring
When all the elements are in place, let’s make the connections. Click on the pencil button shown in Figure 9 or use the F3 shortcut.
Then we draw the connections between the source and the resistance.
Fig. 14: Use F3 or the menu buttons to make the connections of the elements.
Ground
Finally, in order for the program to perform the calculations, it needs a ground point for reference. Click on the triangular button in figure 9 or with the “G” key.
We place the ground on the cable that is connected to the negative terminal of the source, as shown in figure 15.
Fig. 15: For the schematic to work, a reference ground must be added to the circuit.
Simulation
When we finish the schematic, we go on to configure the simulation parameters.
If this is the first time we are going to simulate, click on the Run button shown in figure 16. If this is not the first time, go to the “Simulate” tab and click on “Edit Simulation CMD”.
Fig. 16: Schematic simulation button.
In the Edit Simulation window we are going to choose the last tab called “DC op pnt”, which is shown in figure 17.
Fig. 17: In the simulation configuration window, select the “DC op pnt” tab and click OK.
With this option the program will make a direct current calculation of the circuit, showing the voltages in all the nodes and the currents in all the branches.
Fig. 18: A window appears with the operating values of the DC circuit.
In the window that appears we can see that the current in the resistance is 5 mA, which is condiced with taking the 5 V of the source and dividing them by 1000 Ohms of the resistance, according to the Law of Ohm.
With this we finish the exercise, we are ready to simulate more complex electrical and electronic circuits. In other articles we will talk about how to draw graphs or produce other simulations.
Introduction
In this article we will see the concept of electrical resistance, resistive elements and we will analyze a simple circuit to see the effect it has on the current.
What is electrical resistance?
It is a property of matter that indicates the difficulty that the electric current has in crossing it.
There are materials that have a low resistance, in which the current can flow easily, and there are other materials that have a high resistance, in which it is more difficult for the current to circulate.
Materials with low resistance are called conductors and materials with high resistance are called insulators.
Resistive elements
Fig. 1: Different types of resistance or resistors.
On the other hand “Resistance” is the name given to certain elements that are built with the purpose of having a predictable resistance value, we can see some examples in figure 1.
These elements are used in circuits to make currents behave in a certain way.
Effect on the current in a simple circuit
We are going to simulate a simple circuit with a voltage source of 10 Volts of direct current connected to a resistor. The objective will be to analyze how the current is in the circuit.
Fig. 2: Circuit with 10V source and 1K resistance Ω , current 10mA.
In the first case, illustrated in figure 2, the resistance of the circuit is 1000Ω or 1KΩ (kilo ohm) as it is most often called.
When running the simulation we see that the resulting current is 0.01A (Ampere) or 10mA (milli Ampere).
Fig. 3: Circuit with 10V source and 100mA resistance Ω , 100mA current.
If we now change the resistance value to 100 Ω and simulate again, the current now increases to 100 mA (Figure 3).
In the third test we give the resistance a value of 10 Ω and when simulating the current increases to 1 A, figure 4.
Fig. 4: Circuit with 10V source and 10V resistor Ω , current 1A.
What we observe is that when the resistance value decreases, keeping all the other parameters of the fixed circuit, the current increases.
Conclusion
Resistance is a property that determines how good a material is as an electricity conductor.
Materials with low resistance such as metals are good conductors of electricity, while materials with high resistance are called insulators, such as plastic.
In a simple electrical circuit we can see how the current behaves when we change the resistance, leaving the other parameters fixed. We see that they have an inverse relationship, the lower the resistance, the higher the current.
Introduction
Electricity is so present in our daily lives that we often forget its importance until suddenly a blackout occurs. In this article we will look at the concept of electricity, its application in the home and industry. We are also going to delve into the nature of matter in order to understand where electricity comes from as we know it.
Electricity – home and industry
Preserving our food, heating the water in the house, heating and entertainment are some examples of the application of electricity in the home.
In the industry it is used to run machines that require power, such as motors and fans. It is also used to power control systems.
How do all these electrical devices work?
In all cases what happens is that an electric current circulates through these devices, excites their internal circuits and produces an effect.
Types of electric current
There are two types of electric current, direct current (DC in Spanish, DC in English) and alternating current (AC in Spanish, AC in English).
Direct current is generally used to power digital systems such as LED TVs, computers and radios. While alternating current is used to run motors, resistors to generate heat, among others.
It is possible to convert one type of current into another by using the appropriate device. The most common is the transformer we use to charge the smartphone or notebook, these machines are fed by the alternating current from the household sockets and convert it into direct current.
Power Sources
We know thaenergy has to “come out” from somewhere, in general our house is connected to the electrical network of a city or town and we have plugs or sockets.
This energy comes from power plants that use machines that transform a type of energy such as wind, sun or fossil fuels into electrical energy.
Fig. 1: Wind turbines in Rawson, Argentina. Source Wikipedia.
Fig. 2: Polycrystalline solar panel.
In remote places where the power line does not reach, it is necessary to resort to other solutions in order to obtain electrical energy. For example to install solar panels or generators and to apply much the rational use of the energy.
Fig. 3: Generator I received just at the time of writing this article.
What is electricity?
We have talked about its application, the principle of operation of electrical machines and the types of current, now let’s go a little deeper into the nature of matter to understand more deeply
In antiquity it was discovered that matter could be “loaded” in some way, since when rubbing certain materials with others a force of action appeared at a distance like gravity. We are talking about the typical experiment that we do in primary school in which we rub the ruler on our hair and then we can make bits of paper adhere to it.
In addition it was discovered that there were two types of charges, which were later referred to as positive charge and negative charge.
Observing the interaction between these charged materials it was noted that charges of the same type are repelled and charges of dissimilar type are attracted.
These charges present in matter are what give rise to the electric current.
Conclusion
Electricity is widely used in everyday life to power all kinds of devices. The general principle of all these devices is an electric current that circulates through their interior producing an effect.
There are two types of electric current, direct current (DC) and alternating current (AC). We can convert one type of current into another by using the appropriate device.
Electricity is generated by machines that transform different types of energy into electrical energy.
In the matter there are two types of charge, positive charges and negative charges. If two charges of the same type face each other, the result is a repulsive force between the two. If two charges of a different type face each other, a force of attraction appears between them.
Introduction – Setting up the scene
In this article we will see a very simple trick to bend objects in Blender, for this example we will use Blender’s default cube, here is a couple steps you can do to follow exactly this tutorial.
Create a new Blender file.
Select the default cube and go into edit mode.
Press A to select all vertices.
Press S, then X and write “10” to scale the cube in the X axis, ten times its original size.
Press CTRL+R and move the cursor until you see the yellow square shape from the image below. Turn the mousewheel a couple times to get extra subdivisions and left click to apply the subdivisions. Right click to apply with any displacemente.
You can bend an object in Blender using the “Proportional Editing” feature by enabling the icon shown in the image below or by pressing the “O” shortcut.
Press LEFT-ALT and click on and edge of the object to select and Edge Loop. Press G to grab that edge loop and move it around.
Proportional Editing option allows you to transform now only the selected vertices but also vertices that are nearby with an intensity that is proportional to the distance.
You can change that intensity by spinning the mousewheel.
This editing option is applied also for rotation and changes of scale, so you can use it to apply different transformations to an object.
If you press the icon from the image below you will see different options to apply to the proportional editing option, like the “Connected Only” checkbox that makes the editing affect only those vertices who are connected to our selected vertices. You can also choose a different deformation pattern.
In this article we will see how to apply the glow effect in Blender for the Eevee engine, this effect is also kwown as bloom and it’s a post processing effect, that means is an effect that is applied after the render process.
This functionality not only lets you see the steps on the screen, but also the enemy shots and chests near your position. In addition, by activating this option, you will be able to detect enemies better and know their location more easily.
Step-by-step procedure for displaying on-screen steps in Fortnite.
Step 1: When you are in the Fortnite lobby, you will need to access the game menu that will appear as an icon on the top right of the screen.
Step 2: Once you have accessed the menu, you must go to the bottom of the menu until you find the gear. You will then be able to enter the settings.
Step 3: After completing the above steps, you will be in the settings. There you should find the “sound” section, which is located at the top of the screen, right next to “video”.
Step 4: In the “sound” section, scroll down until you find the “display sound effects” option and activate it.
Introduction
It’s not necessary to create any script to play sounds on mouse hover over UI elements in Unity, you can do it just by adding specific objects to the scene and setting up components on UI elements such as buttons and any other interactable element.
If you prefer you can check the following short video from my YouTube channel, there you will find all you need to do to set up to play sounds on mouse hover over buttons and other UI elements.
What do we need to play sounds on mouse hover in Unity
We basically need three elements in order to play sounds on mouse hover over UI elements, we need a way to play the sound, we need the sound clip to be played and we need a way to detect the mouse hover event over UI elements. Let’s analyze these three elements:
Create at least one AudioSource object in the scene to play the sound
You can create easily a new AudioSource object simply by right clicking in the Hierarchy window, go to audio and click on “AudioSource”, this will create a GameObject with an AudioSource component assigned to it, this AudioSource has the “Play On Awake” checkbox enabled by default so you have to disable it, otherwise the Audio Clip will be played on Start.
Audio files to play on mouse hover
The file of the sound you want to play on mouse hover over UI elements, I suggest you use files with the WAV or OGG format. You can assign the AudioClip to the “Clip” variable in the AudioSource component.
Event trigger component attached on the UI element
We add an EventTrigger component to our button and this allows us to detect different events on this buttons, events like when the mouse cursor hovers over the button, also when a click is made on a button and many other options. In our case we are intereseted in the “Pointer Enter” event which is called when the mouse cursor hovers for the first time a UI element.
How to PLAY SOUNDS on MOUSE HOVER over UI elements in Unity
Once we cover all the previous three steps needed to play sounds on mouse hover in Unity we need to properly configure them. Here is a step by step guide to do it.
Select your button, in the inspector click on “Add Component” and look for the “Event Trigger” component.
Click on “New Event Type” in the Event Trigger and select “Pointer Enter”.
Create a new AudioSource GameObject (or use an existing one) and drag that GameObject to the “Pointer Enter” event.
Using the drop down menu of the “Pointer Enter” event go to the AudioSource section and look for the “PlayOneShot” function.
Drag the Audio file with the sound you want to play on mouse hover to the field of the “Play One Shot” function in the “Pointer Enter” event.
Play and test
Introduction
There are several formats for exporting 3D models in Blender that are compatible with Unity, I recommend that you use one of the following two, the .FBX format or use the Blender file in .Blend format directly.
Before moving on I leave a video showing how to export 3D model in FBX FORMAT from Blender to Unity
In the following video we see not only which format to use to export from Blender to Unity and how to do it, but also other details such as creating new materials in Unity, configuring the textures and assigning those materials to the 3D model in Unity, overwriting the material that is defined in Blender.
If you use the FBX format to export your Blender models to Unity, several things will be packed inside the file besides the 3D models. Some of them are the following:
The hierarchical structure defined in the Outliner will be exported practically the same or very similar and we will see that hierarchical structure in the hierarchy window in Unity.
Object names defined in Blender will also be used in Unity.
The materials defined inside a 3D model in Blender will be present inside the imported file in Unity and will be applied to the 3D model, but in principle they are locked (see figure 1), they cannot be edited, to do so they must be extracted from the FBX file.
The base color chosen in the material will be the same as the one applied to the material in Unity. This for the Principled BSDF shader.
Textures connected to the base color and normals input will be present in Unity as long as the texture files are present when importing the FBX file into Unity. Those textures will be connected to the Albedo and Normals map in Unity.
Animations made with Dope Sheet and Nonlinear Animation clips will be included in the FBX file format.
Objects such as lights and cameras in Blender will be exported as lights and cameras in Unity.
Fig. 1: Material defined in Blender is locked in Unity. To use it you have to extract it from the file.
Disadvantages of using FBX format
One of the main disadvantages is updating the exported model when making changes in Blender. What I do is to replace the file found in the Unity folder with the new exported Blender file. SEE THE PROCEDURE FOR UPDATING MODEL CHANGES IN THE VIDEO ABOVE.
Using the Blender file directly in Unity (.Blend format)
You can use the Blender file directly in Unity and you will have access to most of the items listed above corresponding to the FBX format.
In specific cases problems might occur, for example when changes are made in the version of Blender or Unity, it has happened to me that the Blender file could not be used, but then in subsequent updates the problem was solved.
Fig. 2: Blender file inside a Unity project folder. The file can be opened by double-clicking and you can drag it into the scene to use it.
Advantages of using the .Blend file directly in Unity
For me the main advantage of using the Blender file directly in Unity is the convenience and ease of making changes to the model. With this method we can open the file directly by double clicking it in Unity, edit it, save it and then in Unity the changes are automatically updated.
Disadvantages of using the .Blend file directly in Unity
One of the most important disadvantages of working directly with the Blender file in Unity is the loading times, you may feel that Unity works slower, since it takes a while to process these files, when we add them to the scene and when we modify them, it may be something quite annoying depending on the capabilities of your computer. Although if we think about it, that waiting time may not be as long as the time it takes to re-export in FBX format, replace the file and still wait for the processing time Unity spends on that task.
Another important disadvantage is the fact of working with animations, I have not yet found a good way to work in Unity with a .Blend file with several animation clips made in Blender.
A disadvantage, perhaps not so important given the capabilities of devices nowadays, is that the .Blend file is heavier than the FBX file and also Blender makes a backup copy for each file, so the total weight is even bigger.
What are “COMPONENTS” in Unity and what are they for
A COMPONENT in Unity is a set of data and functions that define a specific behavior. Components are assigned to scene elements called “GameObjects” and give that object a particular behavior. In this article I’m going to share everything I know about components in Unity that I consider important to be able to improve your Unity engine management. Let’s start with one of the most important things:
In general, whatever we want to do in Unity we are going to achieve it through components assigned to GameObjects.
For example if we want to make an object be affected by gravity, if we want to be able to control the object with a controller or keyboard inputs, if we want to play sounds, if we want to display images on screen. All this and more can be achieved using different components assigned to GameObjects of the scene in Unity.
Predefined components in Unity
Fig. 1: Some predefined components of the Unity engine.
The Unity engine has defined by default a wide variety of components that achieve different behaviors, we can see them by selecting a GameObject from the hierarchy and in the inspector click on the “Add Component” button, shown in figure 1, there we will have all the available components sorted in different sections depending on the task they do.
Some examples of these predefined components are AudioSource components that play sounds, SpriteRenderer components that display sprites (images) on the screen, a MeshRenderer component that can display a 3D model on the screen and an AnimatorController component that can control a set of animations and the different transitions between them.
How to CREATE new components in Unity
The components in Unity are nothing more than programming scripts, in the case of the components that are defined by default in Unity are scripts that can not be modified, but the key in all this is that WE CAN CREATE NEW SCRIPTS and by doing so WE ARE CREATING NEW COMPONENTS IN UNITY, these scripts can be assigned to the GameObjects, exactly like the default Unity components.
When assigning a Script to a GameObject, a Script that is nothing more than a component customized by us, Unity will execute this Script, it will execute its instructions, which will allow us to achieve anything we want.
In order for Unity to evaluate a script or a component, some conditions must be met, as we will see below.
How to make a component work in Unity
For any component to do its job in Unity, four conditions must be met, we will list them below and then expand the information about each condition.
The scene that is loaded during execution is the one containing the component.
The component must exist in the scene.
The component must be ACTIVE.
The component must be assigned to an active GameObject in the scene.
If these four conditions are met, the component will perform its programmed task.
It should be noted that in some cases the component may not seem to be doing its job, take the case of an AudioSource that plays a sound, there may be times when the sound is not played, but this does not mean that the component is not working, if the four conditions mentioned above are met Unity is evaluating its behavior, only that its behavior at that time may be not to play the sound until the order of playing is given for example.
Condition 1: The scene where the component is located must be loaded.
An application made in Unity can be divided into different scenes and each scene has its own defined elements. When starting an application in Unity it will automatically load the scene that has been defined with index 0 in Unity’s Build Settings and also at any time we can switch from one scene to another, for example by pressing a “Play” button in the main menu we can load another scene where the gameplay is built.
Fig. 2: Scenes that were added to the compilation of the game or application. At startup, scene 0 will be loaded automatically.
The components in Unity are assigned to GameObjects and the GameObjects belong to a particular scene, therefore if the component we are interested in is in a scene that is not loaded at a certain moment, then its behavior will not be executed, simply because that component does not exist at that precise moment.
Condition 2: The component must exist in the scene.
Fig. 3: Assigning a Script to a GameObject creates an instance of the component that defines the Script.
For a component to execute its behavior it must exist in the scene, this means that we have to “instantiate” it, create an instance of the component we want to use. The simplest way to do this is to choose an appropriate GameObject (or create one) and then in the inspector, with the “Add Component” button, add the component we want to use.
This procedure to add a component can also be done through code, that is to say, from a script we can create an instance of a component and assign it to any GameObject we want, for this last one we need to have the reference of the GameObject to which we want to assign the component.
If the component we are interested in is not instantiated, Unity will not evaluate its behavior.
Condition 3: The component must be active in the scene.
Fig. 4: Activation checkbox of a component in Unity.
Generally the components in Unity have an enable checkbox that allows us to determine if the component is active or inactive, this can be seen in the inspector when selecting a GameObject, in the upper left corner of each component is that enable checkbox, if it is checked the component is active, if it is unchecked the component is inactive.
It is necessary to consider that the activation state can be modified through code, that is to say inside a Script, if we have the reference of that component, we can activate or deactivate it when we need it. Here I have a video in which I show how to do it.
Note: The activation checkbox of a Script that we have created will not be present in the inspector if in the script we do not have defined any of the internal Unity functions (Awake, Start, Update, …). Keep in mind that I am in Unity version 2021.3.18f1, I am not sure if this is true for previous versions and I am not sure, although it is probable, that it is true for later versions.
Read this if you have knowledge of object-oriented programming.
The components in Unity belong to a class called Component, in the hierarchy of classes there are classes like Behaviour or Renderer that inherit directly from the Component class, in this type of components the enable box that we see in the inspector shows the state of an internal variable called “enabled”, a variable that is defined in the Scripts that inherit from classes like Behaviour or Renderer. Let’s take the case of Behaviour objects, these objects are Component but not all components are Behaviours, for example an AudioSource component is a Behaviour and therefore has its enable box. But there are other components such as Transform or Rigidbody that inherit directly from Component and for that reason we do not see the enable box in the inspector.
Condition 4: The component must be assigned to an active GameObject in the scene.
The GameObjects in the hierarchy can be active or inactive in the scene. We can change the state of a GameObject by selecting it and in the inspector, use the checkbox at the top left, if that checkbox is checked the GameObject is active in the scene while if it is unchecked the GameObject is inactive in the scene. It is also possible to activate and deactivate a GameObject through code.
Fig. 5: Activation checkbox of a GameObject in Unity.
If a GameObject is active in the scene, Unity will automatically execute some functions that belong to the active components that are assigned to that GameObject, the most known functions can be the Awake, Start, Update and FixedUpdate functions, but there are many other functions that are part of Unity’s initialization and update cycle.
If the GameObject is not active, these functions will not be automatically executed on the components assigned to the GameObject, however this does not mean that we cannot use those components, even if a component is inactive, we could access it and read some parameter that we are interested in.
Fig. 6: Hierarchical structure of GameObject within a scene in Unity.
In Unity you can establish a hierarchy between different GameObjects, i.e. a GameObject can act as a parent of other GameObjects. The children of a GameObject will be affected by some things that happen to its parents, for example if we move the parent object, all its children will move together. This behavior also happens with the activation state of the GameObject, if the parent is deactivated, all its children (and the children of its children) will be deactivated as well. For this reason, for a component to work in Unity, not only the GameObject to which it is assigned has to be active, but all the GameObjects that are up the hierarchy.
Introduction
Before I start with useful tips and tricks for Blender I will briefly share with you my history with Blender.
A few years ago I had a serious addiction with Blender which is used to create 3D models and animations, I used it a minimum of 4 hours a day trying to recreate all kinds of things that crossed my mind, particularly nothing artistic but I was able to create structures, furniture and other types of objects based on reference images. 3D modeling was something that made me surprise myself of my own capabilities, every time a rendering was completed I felt very proud of my creation. In retrospect I wasn’t doing very amazing things but they were things I had made myself from scratch and that was amazing. So much time and effort spent 3D modeling with Blender and texturing with Substance Painter paid off and today I can include those capabilities as part of my work as a freelance developer.
Below we are going to review 10 useful tips and tricks for using Blender that have helped me to speed up and improve the modeling process, allowing me to accomplish tasks faster or achieve better results.
#1 – Focusing the camera on the selected object in Blender
We start with a shortcut to center the view or even the rendering camera on the selected object. An extremely important trick because it is something that greatly improves the agility when using Blender. With this shortcut you can say goodbye to all that time trying to correctly place the camera on a 3D model or even on a vertex, the center of an edge or a face.
To use it simply select an object or an element of the mesh and press the dot on the numeric keypad, you will see how the camera is centered on the selected element and also, when rotating the camera, the selected element is the center of rotation.
#2 – Hide all objects or geometry except what is selected in Blender
If you are working on a Blender project that has many objects or an object that has a particularly complex mesh, it can be very useful to temporarily hide certain objects and leave visible only what you need to work with. With this simple shortcut you can easily hide selected objects in Blender and when you need to reveal all the hidden objects again.
To isolate elements in Blender simply select the object or mesh element you want to isolate and press SHIFT+H, this will hide all other elements that are not selected. To make all hidden elements visible again press ALT+H.
#3 – Tip to quickly parent and un-parent objects in Blender
When parenting objects one of them becomes the parent object and the other object or objects we choose become the children, this causes the child objects to be automatically affected by the transformations received by the parent object, for example a movement applied to the parent will cause all the children to move together, the same happens for rotations and scale changes.
To quickly parent one object or set of objects to another in Blender you have to go to the Outliner window where all the objects are located, select the ones you want to parent and then drag them to the object you want to parent them to while holding down the SHIFT key, optionally you can press ALT to keep the transformation of the parent objects.
#4 – Render image with transparency in Blender (works for Cycles and Eevee)
In many occasions it is very useful to render only the visible parts of a 3D model and make the rest of the rendering transparent, for example when you want to create a GIF of yourself dancing and place it in an article about Blender tips.
In the properties window go to the render properties tab and there go to the “Film” section, you will find a checkbox called “Transparent”, checking this will make the parts of the render where there is no 3D model transparent. Make sure you use an appropriate image format that supports transparency, such as PNG.
The normals of a 3D model are a mathematical element that allows to know in which direction is pointing a particular face of a 3D model, sometimes in the modeling process certain normals can be inverted, that is pointing towards the inside of the 3D model and this can bring problems with shading, which means problems in the visualization of a material applied to the 3D model and also erratic behavior with light sources. Another important problem arises if we are creating these 3D models to use in a game engine like Unity, in this engine 3D models are rendered with “backface culling”, this means that if we have an inverted face in the graphics engine will be invisible and we will see through it, to solve this just correct the normals of the 3D model, but first we need to be able to see these normals.
To activate the normals of a 3D model it is necessary to be in EDIT MODE. Then in the upper right corner of the Viewport window click on the arrow that displays the “Viewport Overlays” window, almost at the end of it we will find the “Normals” section where we have 3 icons to display the normals, usually I choose to display them in the center of the faces. We can also adjust the length of the normals.
#6 – Know the number of vertices, edges and faces in our scene in Blender.
When we are creating 3D models we may be interested in knowing information about the geometry of the objects we are creating, for example how many vertices, edges, triangles or faces our model has, this can help us to determine if there is any problem with duplicate vertices and also keep track of how many polygons our 3D model has, if we are creating 3D models to use in a graphic engine like Unity it can be important to keep the amount of polygons within a reasonable number according to the model we are creating, especially if the application is for a mobile or virtual reality device, where there are certain limitations with the hardware.
To display information about the number of vertices, edges, faces and objects in Blender we go to the upper right corner of the Viewport window, click on the arrow that displays the “Viewport Overlays” window and check the “Statistics” box at the top of the window.
#7 – Applying the same material to other objects in Blender
When we select an object and we want to apply a color or give it a metallic appearance for example what we do is create a new material, which by default starts with the “Principled BSDF” Shader and we have different values to configure the material as we wish. But what happens if we have a second object and we want it to have the same material? We might be tempted to create a new material and configure it with the same parameters, it is even possible to copy the parameters of one material and apply them to another.
But there is a better alternative, in Blender we can make that two objects have the exact same material applied, that is to say that one or several material slots are pointing to the reference of the same material, in this way we can create a particular instance of a material that we could call “Pine Wood” for example and reuse that same material in all the objects that need the pine wood texture, this not only avoids that we have many unnecessary copies of a material but also allows us to modify the material and that the changes are applied automatically in all the objects where that material is used.
In this case the video is more illustrative but let’s try to summarize the procedure. With an object selected we go to the Materials tab (sphere icon with checkered texture), then if we click the + sign what we will do is create a new “Slot” for a material within our object, here there are two options, one is to click on “New” which creates a new instance of a material, completely independent of the others, the other option is to select an existing material (which interests us in this case), for this we click the icon to the left of the “New” button and select from the list the material we want to assign to the slot.
#8 – Show animation bones always in front of other objects in Blender
When creating animations with Blender using animation bones it is very useful to be able to see these bones at any moment even if they are hidden inside another object or obstructed by an object.
With the “Armature” object selected, go to the “Object Data properties” tab (which has a humanoid icon and is located above the tab with the bone icon), then go to the “Viewport Display” section and check the “In Front” checkbox.
When we gain some experience with Blender we come across the concept of “Edge Loop”, basically it is a set of vertices on a surface that are connected together and the last vertex of the set is connected back to the first one, the key is that of all the possible connections that can be drawn and that meet these conditions, the Edge Loop is like the loop that is connected in the most coherent way in relation to the other surrounding sets of vertices, it is a concept somewhat difficult to explain but it is easy to understand once we start working with them. An example of edge loop can be one of the rings that forms a sphere or a donut in Blender (the correct name is torus but it looks like a donut), each ring is a set of vertices connected forming a loop and this is an edge loop.
To quickly create an Edge Loop in Blender, select an object, go into EDIT MODE and press CTRL+R, then move the cursor to the part of the geometry where you want to add the edge loop, at this point you can scroll the mouse wheel to increase the number of loops to add or manually enter a number by keyboard.
#10 – Easily select Edge Loops and remove them in Blender
There is a quick way to select Edge Loops which allows us to apply transformations on the model, for example increase the size of a particular Edge Loop or move that Edge Loop in one direction and we can also get rid of that Edge Loop in a way that we keep the rest of the model intact, the latter is especially useful when we want to drastically decrease the amount of polygons of a 3D model to use it in a graphics engine like Unity for example.
To quickly select an Edge Loop in Blender we have to be in edit mode of an object, then hold Left ALT and left click on one of the edges that belongs to the Edge Loop that you want to select, if you click on a vertex of the Edge Loop you may select another Edge Loop that goes through the same vertex, so to be sure to select the correct one it is better to click on the edges.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are as essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.