Home »
Misc »
How to make a basketball game in unity
How to make a basketball game in unity
How To Make A Basketball in Unity with Materials and Textures? 🏀 | by Rajat Kumar Gupta
· Overview
· Pre-requisites
· Step 1: Create a folder that contains all the textures
· Step 2: Download a texture
· Step 3: Drop the texture into your Unity project
· Step 4: Apply the downloaded texture to the sphere
· Step 5: Make your basketball bounce
In this article, you will learn how to make a basketball using Materials and Textures in Unity. This microconcept can be extended to create any kind of ball i.e football, tennis ball, snooker balls. That said, it is not just limited to creating balls. You should be able to use this concept to customize the look of any type of geometry(or mesh).
Here is what you will create👇🏻
Basketball🏀
Think of the basketball as a sphere wrapped around with a pretty paper.
Let’s get started.
Your sample scene should have —
- A plane
- A sphere with a custom material
This tutorial is based on the techniques mentioned in an earlier one👇🏻.
How To Apply Color To A Game Object In Unity?
Learn how to add colors to your Game Object in Unity and build your own library of colors for Games, Applications, and…
medium.com
To keep things organized, let’s create a folder that will contain all the textures.
Right-click in Assets Panel > Create > Folder > Name it “Textures”
Since we need a texture for a basketball, simply download one online. A texture is just an image in .png or .jpg format. For now, you can download the basketball texture from here.
Free Textures for Basketball, Beach Ball, Pool Balls, Softball, and Tennis Balls.
Simple, low resolution maps for all kinds of balls! Just apply these to any sphere, in whatever program you are fond…
www.robinwood. com
P.S — Make sure you have the appropriate license to use a texture that you download. The above ones are free to use.
Drag and drop the downloaded texture into the “Textures” folder that you created in Step 1 above.
It is important that your sphere has a custom material in this step. Otherwise, you will not be able to view or modify the various properties of the Material.
Drag and drop the downloaded texture to the box at the left of the Albedo property.
You can do this by following this tutorial that I wrote earlier👇🏻
How To Make Game Objects Bounce In Unity?
Learn how to make your Game Objects bounce on hitting a wall or the floor in Unity for Games, Applications, and AR/VR…
knightcube.medium.com
That’s it!🎉
You successfully used Materials and Textures to create a basketball. Now, you can do the same for all your games or AR/VR experiences that you develop.
Different types of balls behave differently. Try experimenting around with the bounciness and tweaking the different parameters of the Rigid Body Component attached to the sphere to create a golf ball, a football, or a tennis ball.
Enjoy!👏🏻
This article was also published in FreeCodeCamp.
Rajat Kumar Gupta is teaching how to create AR/VR experiences
Hey everyone👋 I just created a page here. You can now buy me a coffee to support me! I write articles and make videos…
www.buymeacoffee.com
Free Course - Complete 3D Game Tutorial
This course has been archived and is no longer supported. For our latest courses on 3D game development, consider trying our evergreen curriculums with a 1-Year Unlimited Access Package.
This 3D game tutorial is an example of lessons from our Unity 3D courses, which are included as a part of our all-access package.
Build your own 3D game from scratch!
3D game development accounts for billions of revenue each year – and consequently, the need for those skilled in game development is constantly on the rise. Even as a hobby, 3D game development is a rewarding experience allowing you to develop lifelong skills in coding or create that 3D game you’ve always dreamed of. Whatever your goals, mastering the foundations of game development can set you up for future success and a lot of lucrative opportunities.
With instruction by an experienced developer, this free tutorial will walk you through creating your first 3D game: a basketball shooting game. With a focus on the Unity 3D game engine, you’ll learn key skills not only in working with Unity 3D’s features – such as game objects, materials, physics, and more – but also with the foundations of C# coding for games. Whether you want to learn to make a 3D game professionally or your own personal development, these game development skills will allow you to expand into development in numerous directions!
You will learn how to:
- Use Unity 3D for game development
- Work with physics and collisions
- Set up first-person characters
- Utilize 3D models and planes
- Add particle effects for good “game feel”
- Access the Unity API for coding mechanics
… and more!
Learn with Certified Instructors
This curriculum has been designed by a Unity Certified Instructor, in collaboration with Unity Certified Programmers, who have been recognized by Unity Technologies for their demonstrated excellence in Unity skills and teaching.
As an Authorized Learning Partner, Zenva's courses satisfy the highest standards in terms of both quality and relevancy.
YOUR COURSES, YOUR WAY
Learn with project-based courses that are designed to be flexible – access them 24/7, fit them around your schedule, and choose the learning materials that suit you best.
You can even download your course videos and watch them offline using the Zenva app, available on iOS and Android.
✅ Watch video lessons
✅ Read text summaries
✅ Explore interactive lessons
✅ Practice with source code
✅ Build real projects
✅ Earn completion certificates
ACHIEVE REAL RESULTS
Our community of 1,000,000+ learners and developers have used the skills learned with us to publish their own games and websites, land their dream jobs, and even start their own businesses – and you have the potential to do the same!
Check out what our learners think below:
⭐⭐⭐⭐⭐
MIHIR PATEL
I love the lectures, concise course objectives, and how they not only teach you enough to get started, but prepare you for the advanced stuff later down the road.
⭐⭐⭐⭐⭐
MONICA MANCUSI
With Zenva, I started learning a more accurate way to approach problems and develop solutions. It’s full of interesting topics that I love to learn in conjunction with my work.
⭐⭐⭐⭐⭐
CRAIG BICKFORD
I chose Zenva because of the large selection of topics and the fact that I can choose what courses I want to take whenever I want to take them. That level of freedom is unique to Zenva.
⭐⭐⭐⭐⭐
ANDREA CARDENAS-ROEDER
The Unity courses at Zenva helped me achieve a level of comfort with game development that I didn’t think was possible. They give you the confidence to expand your skills, and were so easy to understand.
LEARN FROM WORLD-CLASS INSTRUCTORS
Our course instructors participate in elite developer programs and have been recognized for their demonstrated excellence in development and teaching.
That way, you can be confident that you’re learning the most up-to-date content from industry experts.
You need to install Unity (free version is good). Some exposure to programming (any language) is recommended for the scripting parts of this course.
Visual effects in Unity 5 - the experience of the developers of the game Pollen VR - Offtop on vc.ru
What features of Unity 5 did you use when developing Pollen VR to achieve such a high visual quality?
The coolest features of Unity 5 are physically based shading (PBS) and real-time lighting, which we used to the fullest. We had material maps for every surface, and the design of the game required dynamic ambient lighting.
With new global illumination algorithms, all objects and surfaces look just great, and in combination with reflected light, a complete sense of reality is created. Developing a AAA-class computer game requires a huge amount of memory, so having a 64-bit editor was very handy. With Unity 4, we had a lot of crashes due to lack of memory, but thank God those days are gone.
What tools did you use to create the foliage?
Foliage is a fairly simple GPU particle effect. Much more interesting is how we got it right. Since Graphics.DrawProcedural is not integrated into Unity and the new CommandBuffer API does not support compute buffers, we had to come up with a non-standard solution.
We have a cube that is sized to match the borders of the foliage, so we know that whenever the cube is visible, the foliage also needs to be rendered. And now every time we call OnWillRenderObject() on the cube, we render the particles from the compute shader into two render targets in one pass with the MRT and with the settings of the current render camera.
One texture contains information about the diffuse and roughness components, the other about the normal and depth.
When we start rendering the actual cube, the cube shader simply accesses those buffers that have the same parameters and output. The depth is set manually, so we get a very good result from the Z-buffer. To make the leaves look the way we want, we have to take into account all the light and shadow sources.
Due to the fact that all leaves are GPU particles, their animation is cheap. But this is not just a static grid, they should realistically react to the environment (of course, with some restrictions).
Do you have any technologies or workflows that you can share with our readers?
For us, everything worked great, as they say, “out of the box”. The default values strike a good balance between light "baking" time and light quality. Using them, we constantly tried to achieve the best quality, without paying too much attention to the speed of lighting "baking". But our automatic build system scaled the results so that the quality of the GI only improved.
Do you use a combination of real time lighting and baked light?
The design of our games requires all lighting to be done in real time. There is not a single static lightmap in the game.
In Unity 4, we dealt with this limitation by placing dozens of natural light sources around the scene and thus simulating global illumination. It was terrible, because both development and technical support took a lot of time and effort. In addition, we could not manage to avoid light leaks through the walls.
In addition, due to the many light sources, the 'Draw Calls' and 'Fillrate' values became too high, and this, in turn, had a bad effect on the frame rate. When we moved to Unity 5 beta, we switched to Enlighten and eliminated all fake lights in GI. Everything immediately looked better and ran faster, and GI was great at disabling and animating lights in real time.
We also had to create our own Cubemap display system with scene projection and everything. It worked well, but dozens of special shaders were involved, and the editor's capabilities were constantly lacking. We are very pleased that the new Reflection Probes have largely replaced this system of ours. They do not require time-consuming technical support and greatly simplify the workflow.
How did you achieve the glow effect in the corridors?
During the development of the game, we used several volumetric effects. For spotlights we liked implementation by Robert Kupisch, reliable and giving very good volume. Due to the versatility of floodlights, they are convenient to use to highlight the fog above.
In some sections of the game you can see the effects of "volumetric fluid", for which we used Fluidity from the Asset Store. We have used this tool for all scales, from small sparks to a room filled with burning gas. It looks amazing.
In open space, we used our own way of post-processing volumetric fog, we wanted the player to feel the density of Titan's atmosphere.
What tools do you use to generate PBR textures?
Adobe Photoshop and Quixel Suite, plus some reference materials. We have our own "Experimental Playground" where artists can try out models in different lighting conditions.
Have you made any modifications to Unity's new Standard Shader? If yes, please tell us a little about it.
Since our base is not tied to a single point in time and space, we need to render it differently. Since we are a small indie studio, we don't have the resources to start working on a lot of assets, which also look different depending on the "age".
Therefore, we decided to make an extended version of the new standard shader, which will add "grain" to materials. The best thing is that it works for all objects and with the new option, we can get exactly the grain we need for a particular material. With just one shader and a few lines of code, we can change the image however we want.
Unity does not currently support injecting custom code into the Standard Shader. Therefore, we simply copied the built-in shader and saved our code in include files, writing a few #includes in the right places.
What did you use for anti-aliasing?
Since MSAA doesn't handle deferred rendering very well, we had to resort to post-processing. The only thing we have chosen is SMAA as this tool provides a nice and clean solution with good performance. While it may lose sub-pixel or temporal anti-aliasing, the end result is good enough even on the Oculus Rift.
Unity 5's new graphics show us impeccable quality, but what about performance?
Unity 5's new MRT-based deferred algorithm increases framerate by 30% compared to Legacy's dual playthrough. This can greatly increase 'draw calls', and rendering in one pass helps to reduce the number of these calls.
Because VR is so important to us (we recommend playing Pollen with an Oculus Rift), it's essential that the frame rate is as high as possible. Therefore, we support the maximum number of options, setting such visual settings that meet the expectations of the players.
With the settings maxed out, Pollen can max out the fans on your GPU, but you can also lower the settings a bit and play on your old GPU and Oculus Rift.
Please share some advice on optimizing such large scenes.
Unity's Occlusion Culling feature is very efficient, it handles almost everything we need. However, it operates only with visualization and does so only in game mode.
We spent a lot of time making sure that everything was physically correct, whether it was books, basketball, microwave or pear, there were a huge number of physical objects in the game. Unfortunately, Umbra didn't help us much with physics, so we had to write our own portal/culling system.
The rooms of our lunar station are separated by security doors, and we wrote a simple portal system based on these doors. It disables all rooms that the player cannot see. This helped us with physics and even with Umbra, so she had less work to do. In the editor, we also enabled a single room, which allows us to keep 'draw calls' and 'poly count' low and respond quickly to editor commands.
Almost everything else is done by Unity 5, we did not need additional optimization for large scenes, everything worked fine anyway.
If you work on Unity technology, want to talk about your development experience or ask experts a question, leave a request to our mentors using a special form.
How to create your own 2D computer game | 2D Game Platform
Learn how to create 2D games in Unity using tile maps, sprites, 2D physics, animation and more.
Download Unity for free
Made with Unity – Night in the Woods by Finji
Create 2D games with Unity
Unity is the world's most popular 2D and 3D game development platform: 50% of all mobile games are made in Unity! A free version of Unity is now available to users. You will have access to a 2D game development platform and a rich database of free resources created by us and enthusiasts from our wonderful community.
Unity for 2D games
Create a 2D game in a 2D game
Once you download Unity, you'll be able to get started by exploring one of our prebuilt Microgame templates, such as 2D Platformer. Each Microgame template comes with a collection of Mods, fun modifiers that introduce you to the most important ways to work with Unity.
Customize the 2D platformer to your liking
Unity Creator Kit: 2D RPG
Create a 2D RPG in just an hour!
Creator Kits are simple game projects available on Unity Learn that can be mastered in about an hour. The 2D RPG Kit is programming free so you can focus on learning the Unity Editor and customizing the game to suit your ideas and interests.
Develop the first 2D RPG
The Explorer: 2D Kit by Unity
Gameplay Development for 2D Game
The Explorer: 2D is a collection of game mechanics, tools, systems, graphics and other assets for developing 2D games. The set includes an example game created using these systems. This project can be mastered in a couple of hours, and you do not need to write a single line of code.
Get creative with the 2D Game Kit
Unity 2D game project: Ruby's Adventure
Master 2D tools
Ruby's Adventure is a project that will introduce beginner developers to the process of creating and programming a 2D game. On your journey with Ruby, you'll learn how and why to use sprites, how to create your first script, how to use the Tilemap tool, decorate the scene, create particle effects, user interface, sound design, and more.
Join Ruby on her journey
2D graphics tips from the Unity 9 community0124
Thomas Brush: 2D game development tips
The Thomas Brush channel is full of practical tips and inspirational ideas. Start with the video 5 steps to making a gorgeous 2D game and Anyone can make 2D games!
Brackeys: How to make a 2D game
Brackeys is one of the most popular and reputable channels for Unity developers.